I'm pretty new to rails so this is a bit of mystery to me.
I've added some font files to app/assets/fonts
and included them in a SCSS file using asset-url
helper. However I'm now getting errors similar to:
No route matches assets/9df317a3-a79e-422e-b4e2-35ccd29cd5b7 (ActionController::RoutingError)
(note the missing file extension?)
on my Cucumber tests, but only on tests with the @javascript
flag. I've tried the following:
RAILS_ENV=test rake assets:precompile
and the fixes in this thread didn't work:
Capybara tests with :js=>true... Routing Error: No route matches [GET] "/assets"
The thread suggests that there is an incorrect asset somewhere, but this happens even if I remove all but one file from my CSS. Plus the app reports no 404s and the fonts are working in the dev env. These are the only assets in the app!
I'm using:
- Rails 4
- Cucumber
- Capybara
- Poltergeist (for JS tests)
Css:
@font-face{
font-family:"l baskerville w01_n4";
src:asset-url("8dc59876-75a4-4e80-bd1a-735d5f043beb.eot?#iefix")format("eot")
}
etc...
(the files are provided by fonts.com [hence the horrible filenames])
environments/test.rb:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Any help would be appreciated, I'm guessing this is an issue with the asset pipeline in a test and production environment. But I don't know where to start.
Thanks,
LM