Tue 8 Mar 2011
Couldn’t find ‘rspec’ generator – Rails 2.3.10
Posted by kosmas under RSpec, ruby on rails
No Comments
Problem
You are trying to use rspec with Ruby on Rails 2.3.10, but although you install the rspec and rspec-rails gems you get the following error when you try to run script/generate rspec
Couldn't find 'rspec' generator
It turns out that there is a problem with the versions used, so by following the instructions for Rails >= 2.3.10 from here, you should be able to install the plugins and use rspec:
ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.3.1'
ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.3.3'
ruby script/generate rspec
where the last tag (1.3.3) should be the latest tag for each gem.
*** NOTE *** If you get an error like :
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map (NoMethodError)
uncomment the following line (line 11) from features/support/env.rb:
require 'cucumber/rails/rspec'
and run rake cucumber again.