testing - Rails asset pipeline tests pass production broken -
i had following problem asset pipeline.
- i have html email image inside.
- i have tests covering case in email sent successfully.
- all tests pass.
- when going production, feature requiring email sent broken, because html layout referencing non existent image.
this applies precompiled assets.
it seems me tests no longer reliable. there way avoid situation happen again?
i found perfect solution form own case. if set
config.assets.compile = false config.assets.digest = true
in test environment, tests rely on precompiled assets.
since annoying precompile assets every time during quick development , testing phases, in case it's enough have configuration on ci only.
you can setup initializer called ci_config.rb following:
if env['ci'] class yourapp::application config.assets.compile = false config.assets.digest = true end end
and configure ci run rake assets:precompile on start , rake assets:clean on end.
Comments
Post a Comment