6

I'm in the process of converting my Capybara test suite from capybara-webkit to poltergeist.

-require 'capybara/webkit'
+require 'capybara/poltergeist'

-Capybara.javascript_driver = :webkit
+Capybara.javascript_driver = :poltergeist

While running 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 issues 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 it is only the first test in my suite that fails, the rest pass. So 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 fail! Testing is easy! The end.

What is making my first test fail? Why are the rest passing?

More info on request.

awilkening
  • 1,062
  • 8
  • 26

1 Answers1

0

There are two possible solutions to this

A. You are loading images and you might not want to do that (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 spec is failing because you are getting a 404 not found for that asset

# Gemfile
gem 'bootstrap-sass'

Then include it in JavaScript land

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

Then include it in CSS land

# assets/stylesheets/application.scss
@import "bootstrap-sprockets";
@import "bootstrap";
nort
  • 1,625
  • 13
  • 12