The Short Version of the Story
As of August 2012, if you:
- are developing a Ruby on Rails application on OS X,
- and are using capybara-webkit for testing,
- and want to use Font Awesome,
Look out! Serving that font to capybara-webkit will cause it to crash.
We solved the problem by creating a Rails initializer that removes fonts from Sprockets’ asset paths:
The Long Version
We recently brought Font Awesome into our Rails project via Font-Awesome-SASS-Enhanced. It certainly proved itself awesome, but had the side effect of causing our test suite to crash. According to the chatter in this github thread, capybara-webkit and QT are crashing while trying to load the font.
I took inspiration from some of the solutions in that thread to come up with a workaround: I created an initializer that removes font assets from Sprockets’ asset path list. This means that when the test browser requests a font, the server won’t return it, and the test browser will fall back on a font it already has.
I’m uncertain about the long-term effects of removing all custom fonts when the tests are running. I think it’s ok, as browsers should fall back, but I’m nervous I’ve introduced a lurking demon into the test harness. Time will tell.