3
votes

i am working on rails 2.3.5 where i want to us Rspec for testing purpose. I have installed rspec gem but not able to list rspec in generator's list. I am referring https://github.com/rspec/rspec-rails.

group :development, :test do
  gem "rspec", "~> 1.3"
  gem "rspec-rails", "~> 1.3"
end

Thanks.

1
Where did you put that content? Did you set up Bundler correctly?Ryan Bigg
@Ryan => bundler is working fine and I am able to install all the gems with bundler. I have put the above content in a Gemfile.ashisrai_
@Ryan Thanks Ryan. It turns out I had to include other gems as well to run the rspec. I added gem "rspec", "~> 1.3" gem "rspec-core" gem "rspec-expectations" gem "rspec-mocks" gem "rspec-rails", "~> 1.3" gem "shoulda" now its working fine.ashisrai_
I made it work with the generator. Added spec folder and manually added the spec_helper file and added it to the spec file.ashisrai_

1 Answers

6
votes

If you are on rails 2.3.5 you will have to install two plugins :

ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.2.9'

and

ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.2.9'

Then check the rspec generate list

ruby script/generate rspec

Please check https://github.com/dchelimsky/rspec/wiki/rails for further details.

Hope this helps.