I just had my capybara updated to 2.0, and all of my save_and_open_page calls return an html page without styling. It has the style sheets links properly at the top of the page
I was able to fix the problem with save_and_open_page after some blog browsing and digging. I have dropped the capybara_screenshot gem from my project. You can see my working code on my github test_capybara_screenshot repository. The solution that I figured out uses some pointers that I found on the capybara github site.
Assumptions:
The first thing that I do is set it up so that assets are precompiled into a test directory. I do this by adding the following code into the spec/spec_helper.rb
file within the RSpec.configure
loop:
config.before (scope = :suite) do
%x[bundle exec rake assets:precompile]
end
I specify where the assets are pre-compiled to in the config/environments/test.rb
file:
config.assets.prefix = "assets_test" # place test assets in public/assets_test directory
config.action_controller.asset_host = "file://#{::Rails.root}/public"
This makes it so that the test assets are independent of the development assets, and are only generated during a test suite run.
If you do this, you will probably want to have git ignore the /public/assets*
directories.