To automatically open pages saved when using save_and_open_page
we need to add the launchy gem to the test environment.
# Gemfile
group :test do
gem 'launchy', '~> 2.4', '>= 2.4.3'
end
To allow CSS and JavaScript to be loaded we need to specify the asset host and precompile assets for the test environment.
# rails_helper.rb
# Allow CSS and JavaScript to be loaded when we use save_and_open_page.
# The development server must be running at localhost:3000 as specified below.
# Assets need to be precompiled.
# https://github.com/jnicklas/capybara/pull/958
Capybara.asset_host = "http://localhost:3000"
Command line:
rails assets:precompile RAILS_ENV=test