Skip to content
Failed to load latest commit information.
controller_specs Fix empty template rendering for Rails
feature_specs Whitespace only update [ci skip]
helper_specs update or add wording indicating the use of `:type` tagging and our p…
mailer_specs Switch mailer examples on rails version.
matchers add negated render template examples
model_specs use new rspec-mocks feature to verify active_record columns
request_specs add negated render template examples
routing_specs update or add wording indicating the use of `:type` tagging and our p…
step_definitions Added feature specs for have_enqueued_job matcher
support Resolves issue #1044. Adding custom content types to feature, request…
upgrade Note extract of `stub_model` and `mock_model`.
view_specs Fix URL helpers via the `extra_params` API to view specs.
.nav Add option to add rails gems to exclusion filters [Generators] Added generator for ActiveJob Fix warning in generate example of Getting Started updating feature docs to reflect 3.0 final release Add entry for Rails 4.2 to add whitespace checks and fix end of line whitespace
backtrace_filtering.feature Add option to add rails gems to exclusion filters
directory_structure.feature improve docs about metadata `:type`

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


rspec-rails 3 supports Rails 3.x and 4.x. For earlier versions of Rails, you need rspec-rails 1.


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', '~> 3.0.0'

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 file.


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.

Something went wrong with that request. Please try again.