From be9851192e78ffe635087e5583b15ebe683dc0d9 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Sat, 19 Jan 2013 15:33:32 -0800 Subject: [PATCH] Remove incorrect asset_path mapping - Including 'asset_file' (the manifest) fails if asset file is itself templated (erb, coffee), or if asset file uses require_self. - Use require_self if it is necessary to include javascript inside of a sprockets manifest file (like application.js) --- lib/jasmine/asset_expander.rb | 5 ++--- spec/asset_expander_spec.rb | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/jasmine/asset_expander.rb b/lib/jasmine/asset_expander.rb index 484ea30d..7f0f287b 100644 --- a/lib/jasmine/asset_expander.rb +++ b/lib/jasmine/asset_expander.rb @@ -10,9 +10,8 @@ def expand(src_dir, src_path) bundled_asset = @bundled_asset_factory.call(pathname, 'js') return nil unless bundled_asset - base_asset = "#{bundled_asset.pathname.to_s.gsub(/#{src_dir}/, '')}?body=true" - bundled_asset.to_a.inject([base_asset]) do |assets, asset| - assets << "/#{@asset_path_for.call(asset).gsub(/^\//, '')}?body=true" + bundled_asset.to_a.map do |asset| + "/#{@asset_path_for.call(asset).gsub(/^\//, '')}?body=true" end.flatten end end diff --git a/spec/asset_expander_spec.rb b/spec/asset_expander_spec.rb index d47d9eec..b14fc027 100644 --- a/spec/asset_expander_spec.rb +++ b/spec/asset_expander_spec.rb @@ -22,8 +22,7 @@ expander = Jasmine::AssetExpander.new(bundled_asset_getter, asset_path_getter) expanded_assets = expander.expand('/some_src_dir', 'asset_file') - expanded_assets.should == ['/asset_file?body=true', - '/asset1_path?body=true', + expanded_assets.should == ['/asset1_path?body=true', '/asset2_path?body=true'] end