From 3f186e30452b700483c42c8d07f095c7b5c031b8 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 14 Feb 2019 13:51:18 +0900 Subject: Add test for `csp_meta_tag` --- actionview/test/template/csp_helper_test.rb | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 actionview/test/template/csp_helper_test.rb (limited to 'actionview/test/template') diff --git a/actionview/test/template/csp_helper_test.rb b/actionview/test/template/csp_helper_test.rb new file mode 100644 index 0000000000..8bad25ba7d --- /dev/null +++ b/actionview/test/template/csp_helper_test.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require "abstract_unit" + +class CspHelperWithCspEnabledTest < ActionView::TestCase + tests ActionView::Helpers::CspHelper + + def content_security_policy_nonce + "iyhD0Yc0W+c=" + end + + def content_security_policy? + true + end + + def test_csp_meta_tag + assert_equal "", csp_meta_tag + end +end + +class CspHelperWithCspDisabledTest < ActionView::TestCase + tests ActionView::Helpers::CspHelper + + def content_security_policy? + false + end + + def test_csp_meta_tag + assert_nil csp_meta_tag + end +end -- cgit v1.2.3