5

I have strange error that appears only in CI environment. This error does not appear in develpment, production or even local test environments.

ActionController::RoutingError: No route matches [GET] "/fonts/bootstrap/glyphicons-halflings-regular.svg"

Full trace can be found here

In development and production enviroments successfull reqest goes to /assets/bootstrap/glyphicons-halflings-regular.woff. There is a difference in /fonts/ - /assets and svg - woff part. All errors generated by JavaScript enabled tests (Poltergeist / PhantomJS driver). Regular Capybara tests are all green. Chrome devtools says that request for font file is generated by jquery.js, not the page or css file.

  • We can confirm this in our app too. Rails 4.1, Ruby 2.0, Capybara 2.4.1, Poltergeist 1.5.1, PhantomJS 1.9.7. We just switched all our request (Capybara) specs over from default to Poltergeist and are running into this. – Topher Hunt Aug 27 '14 at 19:26
  • This answer may help you in resolving your issue http://stackoverflow.com/a/20297523/1770571 – Salma Gomaa Sep 14 '16 at 10:46
  • This answer may help you in your issue http://stackoverflow.com/a/20297523/1770571 – Salma Gomaa Sep 14 '16 at 10:59

2 Answers2

1

This is related to the bootstrap-sass gem. I'm using version 3.3.4.1 of it with Rails 4.2.

My presenting issue was very similar but slightly different: the same error in CI with 404 for /fonts/bootstrap/glyphicons-halflings-regular.woff but a different path in dev, /fonts/glyphicons....

The solution that worked for me was adding the following line before including the bootstrap JS with SASS:

$icon-font-path: "bootstrap/";
@import 'bootstrap';

My best clue came from the comments on this issue in the gem's tracker: https://github.com/twbs/bootstrap-sass/issues/480#issuecomment-49237119

Dave Burt
  • 1,838
  • 19
  • 20
0

If you have similar setup to us, you installed Bootstrap manually on Rails and had to do some manual CSS style overrides to point the Glyphicon fonts to the right path. (/assets/botostrap... instead of /fonts/bootstrap...). However the original styles are still present in bootstrap.css, and even though they're overridden, it appears that somehow PhantomJS is still detecting and making use of those originals.

In our case, we had to search for all references to glyphicons-halflings in bootstrap.css and change the path to the correct one. After we do so, the routing errors disappear.

Good luck!

Topher Hunt
  • 4,404
  • 2
  • 27
  • 51
  • In my case botstrap is used via [official Bootstrap gem](https://github.com/twbs/bootstrap-sass). So I can't patch it directly. I guess I should play with overriding `$icon-font-path` variable. – Sergey Zyablitsky Aug 28 '14 at 23:19