aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/asset_tag_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/asset_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index 7597927f6d..41e7125e01 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -281,6 +281,26 @@ class AssetTagHelperTest < ActionView::TestCase
assert_equal copy, source
end
+ def test_caching_image_path_with_caching_and_proc_asset_host_using_request
+ ENV['RAILS_ASSET_ID'] = ''
+ ActionController::Base.asset_host = Proc.new do |source, request|
+ if request.ssl?
+ "#{request.protocol}#{request.host_with_port}"
+ else
+ "#{request.protocol}assets#{source.length}.example.com"
+ end
+ end
+
+ ActionController::Base.perform_caching = true
+
+
+ @controller.request.stubs(:ssl?).returns(false)
+ assert_equal "http://assets15.example.com/images/xml.png", image_path("xml.png")
+
+ @controller.request.stubs(:ssl?).returns(true)
+ assert_equal "http://localhost/images/xml.png", image_path("xml.png")
+ end
+
def test_caching_javascript_include_tag_when_caching_on
ENV["RAILS_ASSET_ID"] = ""
ActionController::Base.asset_host = 'http://a0.example.com'