1

I'm getting the following error when I run Capybara tests with js: true option:

No route matches [GET] "/fonts/fontawesome-webfont.woff"

Obviously, this error is not related to the Capybara but to the Font Awesome.

I found a solution on https://stackoverflow.com/a/14945023/513554, but after some investigation I found another workaround which may help people.

So I post a Q&A.

Community
  • 1
  • 1
Tsutomu
  • 4,848
  • 1
  • 46
  • 68

1 Answers1

0

Make following modifications in your config/routes.rb:

Rails.application.configure do
  ...
  get 'fonts/*anything' => 'fonts#dummy'
end

And create a separate controller:

class FontsController < ApplicationController
  def dummy
    head :ok
  end
end

By setting config.action_dispatch.show_exceptions = true, your tests get passed but routing error messages are scattered around your test.log. My workaround doesn't have such a downside.

Tsutomu
  • 4,848
  • 1
  • 46
  • 68