I had the following problem with the asset pipeline.
- I have an HTML email with an image inside.
- I have tests covering the case in which the email is sent successfully.
- All tests pass.
- When going to production, the feature requiring the email to be sent is broken, because the HTML layout is referencing a non existent image.
This obviously applies to all precompiled assets.
It seems to me that suddenly tests are no longer reliable. Is there any way to avoid this situation to happen again?
I found the perfect solution form my own case. If you set
in test environment, your tests will rely on precompiled assets.
Since it is annoying to precompile assets every time during quick development and testing phases, in my case it’s enough to have this configuration on CI only.
You can setup an initializer called ci_config.rb with the following:
And configure you CI to run rake assets:precompile on start and rake assets:clean on end.