diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-22 22:11:32 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:08 +0200 |
commit | a132229d7b4382d9ffe8847fa58f469cb8f2ecfc (patch) | |
tree | 0ee1db3d25a6d3319ba5f4d575c9c9f39ab6aea9 /actionpack/test | |
parent | abeb0ff2cc99967b852c509e5d3bd186fa8a184c (diff) | |
download | rails-a132229d7b4382d9ffe8847fa58f469cb8f2ecfc.tar.gz rails-a132229d7b4382d9ffe8847fa58f469cb8f2ecfc.tar.bz2 rails-a132229d7b4382d9ffe8847fa58f469cb8f2ecfc.zip |
Added ability to set asset_path for engines
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 6d5e4893c4..2b83cfe1a9 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -387,6 +387,15 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal %(<img alt="Rails" src="#{expected_path}" />), image_tag("rails.png") end + def test_env_asset_path + @controller.config.asset_path = "/assets%s" + def @controller.env; @_env ||= {} end + @controller.env["action_dispatch.asset_path"] = "/omg%s" + + expected_path = "/assets/omg/images/rails.png" + assert_equal %(<img alt="Rails" src="#{expected_path}" />), image_tag("rails.png") + end + def test_proc_asset_id @controller.config.asset_path = Proc.new do |asset_path| "/assets.v12345#{asset_path}" @@ -396,6 +405,20 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal %(<img alt="Rails" src="#{expected_path}" />), image_tag("rails.png") end + def test_env_proc_asset_path + @controller.config.asset_path = Proc.new do |asset_path| + "/assets.v12345#{asset_path}" + end + + def @controller.env; @_env ||= {} end + @controller.env["action_dispatch.asset_path"] = Proc.new do |asset_path| + "/omg#{asset_path}" + end + + expected_path = "/assets.v12345/omg/images/rails.png" + assert_equal %(<img alt="Rails" src="#{expected_path}" />), image_tag("rails.png") + end + def test_image_tag_interpreting_email_cid_correctly # An inline image has no need for an alt tag to be automatically generated from the cid: assert_equal '<img src="cid:thi%25%25sis@acontentid" />', image_tag("cid:thi%25%25sis@acontentid") |