Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with JavaScript enabled tests (Bootstrap 3, Rails 4, Travis CI)

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.

like image 333
Sergey Zyablitsky Avatar asked Nov 11 '22 03:11

Sergey Zyablitsky


1 Answers

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

like image 94
Dave Burt Avatar answered Nov 14 '22 22:11

Dave Burt