Question

In tracking down some issues which only appear in precompiled assets, I would like to write some integration tests which reference the compiled assets. Try as I might, I have been unable to get integration tests responses which seem to reference assets that use digested paths.

I have tried adding the following to config/environments/test.rb

config.assets.compile = true

My layout has:

stylesheet_link_tag 'application'

Before running tests I run:

rake assets:precompile

Now when I run the integration tests I'm expecting the responses to include links in the form of assets/application-0f75109cfd6dc785c7bee4647913bc16.css, but it does it's simply `assets/application.css.

How could I enable such behavior?

Was it helpful?

Solution

I added the following to config/environments/test.rb:

config.assets.digest = true

According to the sprocket-rails README:

When enabled, fingerprints will be added to asset filenames.

This works in Rails 4.2.0.rc3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top