aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/asset_tag_helper_test.rb
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2018-04-18 18:49:27 +0100
committerGitHub <noreply@github.com>2018-04-18 18:49:27 +0100
commit185fce159721b331cc9a0ae17b662373ee0fc95f (patch)
treeaa5c6d50a33ad5681e1703fe0cffcf74927f9f12 /actionview/test/template/asset_tag_helper_test.rb
parent7bcb04c73decc9fa0448cf75caeee6740942ad29 (diff)
parent47013a7126a92e1f2890b68e0fd2e7ba1b77c97c (diff)
downloadrails-185fce159721b331cc9a0ae17b662373ee0fc95f.tar.gz
rails-185fce159721b331cc9a0ae17b662373ee0fc95f.tar.bz2
rails-185fce159721b331cc9a0ae17b662373ee0fc95f.zip
Merge pull request #32607 from yaroslav/feature/nonce-for-javascript_include_tag
Add the `nonce: true` option for `javascript_include_tag` helper.
Diffstat (limited to 'actionview/test/template/asset_tag_helper_test.rb')
-rw-r--r--actionview/test/template/asset_tag_helper_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb
index 6d98eacfb8..e68f03d1f4 100644
--- a/actionview/test/template/asset_tag_helper_test.rb
+++ b/actionview/test/template/asset_tag_helper_test.rb
@@ -29,6 +29,10 @@ class AssetTagHelperTest < ActionView::TestCase
"http://www.example.com"
end
+ def content_security_policy_nonce
+ "iyhD0Yc0W+c="
+ end
+
AssetPathToTag = {
%(asset_path("")) => %(),
%(asset_path(" ")) => %(),
@@ -421,6 +425,10 @@ class AssetTagHelperTest < ActionView::TestCase
assert_dom_equal %(<script src="//assets.example.com/javascripts/prototype.js"></script>), javascript_include_tag("prototype")
end
+ def test_javascript_include_tag_nonce
+ assert_dom_equal %(<script src="/javascripts/bank.js" nonce="iyhD0Yc0W+c="></script>), javascript_include_tag("bank", nonce: true)
+ end
+
def test_stylesheet_path
StylePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
end