aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-10-12 14:57:38 -0500
committerJoshua Peek <josh@joshpeek.com>2012-10-12 14:57:38 -0500
commitbd38d9f2118b1005718f8db4292b21a73879409e (patch)
tree023697aad4a0475efbf5edb1bbe856d541a9e64f /actionpack/test
parentb62f51d55d5f0a1a693866f5083dbdb6af0fd237 (diff)
downloadrails-bd38d9f2118b1005718f8db4292b21a73879409e.tar.gz
rails-bd38d9f2118b1005718f8db4292b21a73879409e.tar.bz2
rails-bd38d9f2118b1005718f8db4292b21a73879409e.zip
Add asset_path and asset_url helpers
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index 754622c883..ac73e9515c 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -55,6 +55,19 @@ class AssetTagHelperTest < ActionView::TestCase
ENV.delete('RAILS_ASSET_ID')
end
+ AssetPathToTag = {
+ %(asset_path("foo")) => %(/foo),
+ %(asset_path("style.css")) => %(/style.css),
+ %(asset_path("xmlhr.js")) => %(/xmlhr.js),
+ %(asset_path("xml.png")) => %(/xml.png),
+ %(asset_path("dir/xml.png")) => %(/dir/xml.png),
+ %(asset_path("/dir/xml.png")) => %(/dir/xml.png),
+
+ %(asset_path("style", type: :stylesheet)) => %(/stylesheets/style.css),
+ %(asset_path("xmlhr", type: :javascript)) => %(/javascripts/xmlhr.js),
+ %(asset_path("xml.png", type: :image)) => %(/images/xml.png)
+ }
+
AutoDiscoveryToTag = {
%(auto_discovery_link_tag) => %(<link href="http://www.example.com" rel="alternate" title="RSS" type="application/rss+xml" />),
%(auto_discovery_link_tag(:rss)) => %(<link href="http://www.example.com" rel="alternate" title="RSS" type="application/rss+xml" />),
@@ -293,6 +306,11 @@ class AssetTagHelperTest < ActionView::TestCase
assert_equal expected, result
end
+ def test_asset_path_tag
+ ENV["RAILS_ASSET_ID"] = ""
+ AssetPathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
+ end
+
def test_auto_discovery_link_tag
AutoDiscoveryToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
end