$ rails new testing-like-the-gods -T
Add
rspec-rails
to both the:development
and:test
groups in theGemfile
:
group :development, :test do
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
end
Download and install by running:
bundle install
Initialize the
spec/
directory (where specs will reside) with:
rails generate rspec:install
This adds the following files which are used for configuration:
.rspec
spec/spec_helper.rb
spec/rails_helper.rb
Check the comments in each file for more information.
Use the rspec
command to run your specs:
bundle exec rspec