aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-09-23 09:34:04 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-09-23 09:34:04 -0700
commit5dcb269eb8c8730084734e845534d3b9580c40f4 (patch)
treeb9dd0df70acd36cdda25aea89c58f3a0b0751380
parent36699977f2ddbb937aac97998d2d8503499c57e0 (diff)
parentc070cc4ab41fd848fc72f19e7f99d75b1e1fd097 (diff)
downloadrails-5dcb269eb8c8730084734e845534d3b9580c40f4.tar.gz
rails-5dcb269eb8c8730084734e845534d3b9580c40f4.tar.bz2
rails-5dcb269eb8c8730084734e845534d3b9580c40f4.zip
Merge pull request #3092 from asee/master
Sprockets to use config.assets.prefix, with tests
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb2
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 457ab93ae3..c569124c94 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -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
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index c0fb07a29b..a44a16750f 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -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")