Permalink
Browse files

Merge pull request #3138 from christos/correct_image_path_with_pipeline

Correctly override image_path in sprockets rails_helper
  • Loading branch information...
1 parent b703cdb commit 493077cdc0251068e9252d831acb1cd978c9d6bf @spastorino spastorino committed Sep 26, 2011
@@ -60,9 +60,10 @@ def asset_path(source, options = {})
options[:body] ? "#{path}?body=1" : path
end
- def path_to_image(source)
- asset_paths.compute_public_path(source, asset_prefix)
+ def image_path(source)
+ asset_path(source)
end
+ alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
private
def debug_assets?
@@ -129,6 +129,14 @@ def url_for(*args)
assert_dom_equal '<img alt="Xml" src="/assets/xml.png" />', image_tag("xml.png")
end
+ test "image_path" do
+ assert_match %r{/assets/logo-[0-9a-f]+.png},
+ image_path("logo.png")
+
+ assert_match %r{/assets/logo-[0-9a-f]+.png},
+ path_to_image("logo.png")
+ end
+
test "stylesheets served without a controller in do not use asset hosts when the default protocol is :request" do
remove_instance_variable("@controller")
@config.action_controller.asset_host = "assets-%d.example.com"

0 comments on commit 493077c

Please sign in to comment.