Skip to content
Browse files

Fixing the #image_path bug.

Pardino::Helper's #image_path was taking precedence over
Sprockets::Helper's version, which was causing really strange
argument error bugs.
  • Loading branch information...
1 parent f4b5860 commit 3529f87a1063cb94493fc50bf4f7a6befd682410 @petebrowne committed Jan 5, 2012
Showing with 15 additions and 0 deletions.
  1. +5 −0 lib/machined/helpers/asset_tag_helpers.rb
  2. +10 −0 spec/machined/helpers/asset_tag_helpers_spec.rb
View
5 lib/machined/helpers/asset_tag_helpers.rb
@@ -15,6 +15,11 @@ def asset_path(source, options = {})
path_to_asset source, options
end
end
+
+ # Redefine image_path to work with Sprockets::Helpers.
+ def image_path(source, options = {})
+ asset_path source, { :dir => "images" }.merge(options)
+ end
end
end
end
View
10 spec/machined/helpers/asset_tag_helpers_spec.rb
@@ -65,4 +65,14 @@
end
end
end
+
+ describe "#asset_path" do
+ it "is compatible with the Sprockets::Helpers API" do
+ within_construct do |c|
+ c.file "assets/images/logo.jpg"
+
+ context.image_path("logo.jpg", :digest => true).should =~ %r(/assets/logo-[0-9a-f]+.jpg)
+ end
+ end
+ end
end

0 comments on commit 3529f87

Please sign in to comment.
Something went wrong with that request. Please try again.