documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Is it possible to package assets in the test environment? #215

Closed normally-andrew closed 12 years ago

normally-andrew commented 12 years ago

We're using Jammit to package several JS templates into one namespace. When we run our Capybara integration tests, the namespace doesn't exist because Jammit isn't packaging, and the tests error out.

I realize the logic for not packaging assets in test, but is there a config to turn it back on?

jashkenas commented 12 years ago

I think that someone else just asked for Jammit to never package assets in test ... which is why it behaves the way it does.

Can't you just force the packaging back on manually in your test environment?

normally-andrew commented 12 years ago

Indeed, someone did. I'd love to force packaging back on in test, but I don't know if there is a way to do that.

jashkenas commented 12 years ago

The assets.yml file supports ERB, so you can simply interpolate the value you like, in the environment you like.

normally-andrew commented 12 years ago

So you mean doing something like this:

<%= "package_assets: true" if ENV['RAILS_ENV'] == 'true' %>

will override the default for the test environment?

jashkenas commented 12 years ago

Yes, I do.

<%= "package_assets: true" unless Rails.env.development? %>
normally-andrew commented 12 years ago

Thanks, ended up just setting package_assets to 'always', got the job done.