Install RSpec, Capybara, FactoryBot
Last updated
Last updated
Install this gem inside group :development, :test
NOTE: it must be gem 'rspec-rails' (not gem 'rspec' as it's github shows)
rails generate rspec:install
Generate a stub: bundle binstubs rspec-core
Enable --only-failures
by doing the following:
In spec/spec_helper.rb, uncomment this line: config.example_status_persistence_file_path = "spec/examples.txt"
Create the file (leave it blank): spec/examples.txt
Add /spec/examples.txt
to .gitignore
Note: If using Jumpstart, capybara is already included
Install this gem inside group :test
Install FactoryBot:
In spec/rails_helper.rb, inside of Rspec.configure do |config|
... add the following:
config.include Devise::Test::IntegrationHelpers, type: :feature
config.include FactoryBot::Syntax::Methods
This assumes you're using a fresh install of Jumpstart.
Create the following files:
spec/factories/account.rb
:
spec/factories/user.rb
:
spec/factories/account_user.rb
:
Create this in spec/features/example_spec.rb
:
This example assumes you're using a fresh install of Jumpstart. You might need to adjust the content of this spec for it to work.