Rspec :: Additions

 1.

Uncomment following line from rails_helper.rb so all files inside spec/support are loaded automatically by rspec

  # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }

  Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
2.
  1. Check factory bot rails version inside Gemfile.lock and update the gem with that version in Gemfile. It was 6.1.0 while writing this tutorial, yours may be different depending on latest gem version.

      group :development, :test do
        gem 'factory_bot_rails', '~> 6.1.0'
      end
3.
  1. Add factories folder inside spec folder if it doesn’t already exist. You can then create factories inside spec/factories folder.

Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5