Webfont path, rspec, capybara and poltergeist

I am currently processing my Capybara test suite from capybara-webkit to poltergeist.

-require 'capybara/webkit' +require 'capybara/poltergeist' -Capybara.javascript_driver = :webkit +Capybara.javascript_driver = :poltergeist 

When starting my test, the first test failed with this message ...

 Failure/Error: Unable to find matching line from backtrace ActionController::RoutingError: No route matches [GET] "/assets/fonts/glyphicons-halflings-regular.ttf" 

After some investigation, I found similar problems here .

However, I have a manual installation of bootstrap.css. I made adjustments to the path, as suggested in the second answer, and I received the same message with the updated path.

After some time and frustration, I realized that this is only the first test in my package that fails, the rest pass. Naturally, I deleted the first test. Now the β€œnew” first test fails, and the rest pass. So I deleted them all. Now none of them will work! Testing is easy! The end.

What makes my first test fail? Why do the rest go through?

Additional information on request.

+6
source share
1 answer

There are two possible solutions for this.

a. You upload images, and you may not want to do this (speeds up tests, etc.).

 Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, :timeout => 60, :phantomjs_logger => File.open(File::NULL), # silence JavaScript console.log :phantomjs_options => %w(--load-images=false --ignore-ssl-errors=true), ) end 

B. The specification does not work because you get 404 not found for this asset.

 # Gemfile gem 'bootstrap-sass' 

Then include it in the land of JavaScript

 # assets/javascripts/application.js //= require bootstrap-sprockets 

Then turn it into CSS ground

 # assets/stylesheets/application.scss @import "bootstrap-sprockets"; @import "bootstrap"; 
0
source

All Articles