From 9da48a998c6f8102bfc83b80e65edbcc542036c6 Mon Sep 17 00:00:00 2001 From: Paul Nikitochkin Date: Wed, 8 May 2013 22:10:40 +0300 Subject: #10428: Added tests for config.assets.precompile Tests for bug in sprocket-rails: do not use value of configuration options which changed after environment loaded --- railties/test/application/assets_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'railties') diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 94446c6c1b..633d864dac 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -165,6 +165,29 @@ module ApplicationTests assert_file_exists("#{app_path}/public/assets/something-*.js") end + test 'precompile use assets defined in app env config' do + add_to_env_config 'production', 'config.assets.precompile = [ "something.js" ]' + + app_file 'app/assets/javascripts/something.js.erb', 'alert();' + + precompile! 'RAILS_ENV=production' + + assert_file_exists("#{app_path}/public/assets/something-*.js") + end + + test 'precompile use assets defined in app config and reassigned in app env config' do + add_to_config 'config.assets.precompile = [ "something.js" ]' + add_to_env_config 'production', 'config.assets.precompile += [ "another.js" ]' + + app_file 'app/assets/javascripts/something.js.erb', 'alert();' + app_file 'app/assets/javascripts/another.js.erb', 'alert();' + + precompile! 'RAILS_ENV=production' + + assert_file_exists("#{app_path}/public/assets/something-*.js") + assert_file_exists("#{app_path}/public/assets/another-*.js") + end + test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do add_to_config "config.assets.digest = true" add_to_config "config.action_controller.perform_caching = false" -- cgit v1.2.3