A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
# environments/capybara.rb | |
Dummy::Application.configure do | |
config.serve_static_assets = true | |
config.static_cache_control = "public, max-age=3600" | |
config.assets.compress = true | |
config.assets.compile = false | |
config.assets.precompile += %w(email.css) | |
config.assets.digest = true | |
config.assets.prefix = "/capybara_test_assets" | |
end |
# spec/request_helper.rb | |
ENV["RAILS_ENV"] = 'capybara' | |
RSpec.configure do |config| | |
config.before(:suite) do | |
%x[bundle exec rake assets:precompile] | |
end | |
end |