Permalink
Browse files

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)
  • Loading branch information...
ragaskar committed Jan 19, 2013
1 parent 63e8d46 commit be9851192e78ffe635087e5583b15ebe683dc0d9
Showing with 3 additions and 5 deletions.
  1. +2 −3 lib/jasmine/asset_expander.rb
  2. +1 −2 spec/asset_expander_spec.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
@@ -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

0 comments on commit be98511

Please sign in to comment.