Skip to content
Chris Jones edited this page Apr 10, 2019 · 3 revisions

Notes

  • RSpec is not included in a default rails application.

To setup RSpec and friends 👫 to work with a bundled ruby application add the below gems to the project's Gemfile

group :development, :test do
  gem “rspec-rails”, ~> 3.1.0
  gem “factory_bot_rails”, ~> 4.4.1
end

group :test do
  gem “faker”, ~> 1.4.3
  gem “capybara”, ~> 2.4.3
  gem “database_cleaner”, ~> 1.3.0
  gem “launchy”, ~> 2.4.2
  gem “selenium-webdriver”, ~> 2.43.0
end

To install RSpec within the bundled project

rails generate rspec:install

To test connectivity with the databases set-up in the config/database.yml run the below rake task.

bin/rake db:create:all

RSpec Configuration

The below command will setup RSpec within a rails project

rails g rspec:install

To run the current tests in the test suite

bundle exec rspec

To install the binstubs for Rspec

bundle binstubs rspec-core
Clone this wiki locally