For a new project, you can setup the Rspec test suite in three steps.
First, generate the project without Test::Unit (which is what the
rails new new_project_name -T
Next, make sure you have Rspec in your Gemfile:
... group :development, :test do ... gem 'rspec-rails' end
Finally, use the Rails installer to generate the specs:
rails g rspec:install
To check that this worked, you should see a
spec directory instead of
test from the project root:
Don’t forget to prepare the db for testing after you run any new migrations:
Check out the Rspec docs for more details.