mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixes #1489 again, with updated code and numerous tests to confirm
This commit is contained in:
parent
caa95ab6d8
commit
c070cc4ab4
2 changed files with 11 additions and 1 deletions
|
@ -57,7 +57,7 @@ module Sprockets
|
|||
|
||||
def asset_path(source, options = {})
|
||||
source = source.logical_path if source.respond_to?(:logical_path)
|
||||
path = asset_paths.compute_public_path(source, 'assets', options.merge(:body => true))
|
||||
path = asset_paths.compute_public_path(source, asset_prefix, options.merge(:body => true))
|
||||
options[:body] ? "#{path}?body=1" : path
|
||||
end
|
||||
|
||||
|
|
|
@ -47,6 +47,16 @@ class SprocketsHelperTest < ActionView::TestCase
|
|||
asset_path("logo.png", :digest => false)
|
||||
end
|
||||
|
||||
test "custom_asset_path" do
|
||||
@config.assets.prefix = '/s'
|
||||
assert_match %r{/s/logo-[0-9a-f]+.png},
|
||||
asset_path("logo.png")
|
||||
assert_match %r{/s/logo-[0-9a-f]+.png},
|
||||
asset_path("logo.png", :digest => true)
|
||||
assert_match %r{/s/logo.png},
|
||||
asset_path("logo.png", :digest => false)
|
||||
end
|
||||
|
||||
test "asset_path with root relative assets" do
|
||||
assert_equal "/images/logo",
|
||||
asset_path("/images/logo")
|
||||
|
|
Loading…
Reference in a new issue