Rails RSpec test environment configuration

List of gems

    group :development, :test do
      # This gem implements the rspec command for Spring.
      gem 'spring-commands-rspec'
      gem 'rspec-rails', '~> 3.6'
      gem 'factory_bot_rails'

      gem 'capybara', '~> 2.13'
      gem 'selenium-webdriver'

      gem 'guard-rspec'
      gem 'rb-fsevent', require: false
      gem 'terminal-notifier-guard'

    group :test do
      gem 'faker'
      gem 'database_cleaner'

    group :development do
      # This gem makes Spring watch the filesystem for changes using Listen rather than by polling the filesystem.
      gem 'spring-watcher-listen'

Install gems:

bundle install

Initialize the spec/ directory with:

bundle exec rails generate rspec:install

Add rspec bin directory for spring

bundle exec spring binstub rspec

Restart spring spring stop

Run bin/rspec to start rspec under spring

Guard::RSpec allows to automatically & intelligently launch specs when files are modified.

Add guard definition to your Guardfile by running this command:

bundle exec guard init rspec

Change generate Guardfile to you rspec spring. You

guard :rspec, cmd: "bin/rspec" do

Install chrome driver brew install chromedriver if you have not installed Chrome