Precompile properly refers files referenced with asset_path test

This commit is contained in:
Santiago Pastorino 2011-10-02 13:57:29 -02:00
parent 9b34e31155
commit c1547fcf6d

@ -244,7 +244,7 @@ class ::PostsController < ActionController::Base ; end
assert_match(/app.js isn't precompiled/, last_response.body)
end
test "precompile appends the md5 hash to files referenced with asset_path and run in the provided RAILS_ENV" do
test "precompile properly refers files referenced with asset_path and and run in the provided RAILS_ENV" do
app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
# digest is default in false, we must enable it for test environment
add_to_config "config.assets.digest = true"
@ -252,6 +252,8 @@ class ::PostsController < ActionController::Base ; end
capture(:stdout) do
Dir.chdir(app_path){ `bundle exec rake assets:precompile RAILS_ENV=test` }
end
file = Dir["#{app_path}/public/assets/application.css"].first
assert_match(/\/assets\/rails\.png/, File.read(file))
file = Dir["#{app_path}/public/assets/application-*.css"].first
assert_match(/\/assets\/rails-([0-z]+)\.png/, File.read(file))
end