Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clone this wiki locally
rspec-rails extends RSpec and Ruby on Rails so you can specify the behaviour of your rails web-app.
Rails 3 requires rspec 2 . Development of rspec-rails-2 has moved to github.com/rspec/rspec-rails.
For rails, you’ll want to somehow have access to both “rspec” and “rspec-rails”
Here are various ways.
rspec and rspec-rails gemsUse
rspec and rspec-rails plugins for Rails >= 2.1.0Install
ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.2.9' ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.2.9' ruby script/generate rspec
(change 1.2.9 to the latest gem released version)
rspec and rspec-rails plugins for Rails < 2.1.0Install
cd vendor/plugins git clone git://github.com/dchelimsky/rspec.git git clone git://github.com/dchelimsky/rspec-rails.git cd rspec git checkout 1.1.8 cd ../rspec-rails git checkout 1.1.8 cd .. rm -rf rspec/.git rm -rf rspec-rails/.git cd ../../ ruby script/generate rspec
File Layout Necessary
You can see a demo rspec layout by running
ruby script/generate rspec_scaffold ModelName (creates model, specs).
It’s also listed here.