From 19987b64af0d543a6292c3fd9b0b877f70eab306 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 30 Sep 2012 14:46:06 -0700 Subject: Asset manifest includes aliases for foo.js -> foo/index.js and vice versa. Bump Sprockets requirements from 2.1+ to 2.2+ and let it answer "should we compile this asset?" for us. --- railties/test/application/assets_test.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 5a1df5d330..9e9702efb6 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -122,8 +122,23 @@ module ApplicationTests app_file "app/assets/javascripts/something/index.js.erb", "alert();" precompile! - assert File.exists?("#{app_path}/public/assets/something.js") + + assets = YAML.load_file("#{app_path}/public/assets/manifest.yml") + assert_not_nil assets['something/index.js'], "Expected something/index.js among #{assets.keys.inspect}" + assert_not_nil assets['something.js'], "Expected something.js among #{assets.keys.inspect}" + end + + test "precompile something/index.js for directory containing index file" do + add_to_config "config.assets.precompile = [ 'something/index.js' ]" + app_file "app/assets/javascripts/something/index.js.erb", "alert();" + + precompile! + assert File.exists?("#{app_path}/public/assets/something/index.js") + + assets = YAML.load_file("#{app_path}/public/assets/manifest.yml") + assert_not_nil assets['something/index.js'], "Expected something/index.js among #{assets.keys.inspect}" + assert_not_nil assets['something.js'], "Expected something.js among #{assets.keys.inspect}" end test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do -- cgit v1.2.3