Logo: Relish

  1. Sign in

Project: RSpec Rails 2.13

RSpec Rails 2.13

rspec-rails extends Rails' built-in testing framework to support rspec examples
for requests, controllers, models, views, helpers, mailers and routing.


rspec-rails-2 supports rails-3.0.0 and later. For earlier versions of Rails,
you need rspec-rails-1.3.


gem install rspec-rails

This installs the following gems:



Add rspec-rails to the :test and :development groups in the Gemfile:

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

It needs to be in the :development group to expose generators and rake tasks
without having to type RAILS_ENV=test.

Now you can run:

script/rails generate rspec:install

This adds the spec directory and some skeleton files, including a .rspec

Webrat and Capybara

You can choose between webrat or capybara for simulating a browser, automating
a browser, or setting expectations using the matchers they supply. Just add
your preference to the Gemfile:

gem "webrat"
gem "capybara"


The documentation for rspec-rails is a work in progress. We'll be adding
Cucumber features over time, and clarifying existing ones. If you have
specific features you'd like to see added, find the existing documentation
incomplete or confusing, or, better yet, wish to write a missing Cucumber
feature yourself, please submit an issue or a pull request.


  1. Autotest
  2. Changelog
  3. Controller specs
  4. Feature specs
  5. Generators
  6. GettingStarted
  7. Helper specs
  8. Mailer specs
  9. Matchers
  10. Mocks
  11. Model specs
  12. RailsVersions
  13. Request specs
  14. Routing specs
  15. Transactions
  16. Upgrade
  17. View specs

Last published over 7 years ago by alindeman.