문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top