--For those who want to test with RSpec on Rails6.0
$ rails -v
Rails 6.0.3.1
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
Gemfile
group :development, :test do
gem 'rspec-rails'
end
$ bundle install
$ rails g rspec:install
Install gem and create a configuration file with a generator.
.rspec
--require spec_helper
--format documentation
Set the test to document format.
Gemfile
group :test do
gem 'capybara', '>= 2.15'
gem 'webdrivers'
end
$ bundle install
First, install the gem.
spec/rails_helper.rb
RSpec.configure do |config|
#Added just before the bottom
config.before(:each) do |example|
if example.metadata[:type] == :system
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end
end
end
Change RSpec settings so that the browser test works.
Recommended Posts