diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2018-11-06 18:11:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-06 18:11:15 -0500 |
commit | 90ee327b632f454c3cd7265be5f96a74d160c536 (patch) | |
tree | f3d011815b0068c811bff8468c43f16229596823 /railties/test | |
parent | bb11a9acab15b87d6074fb6af9405287942a7eee (diff) | |
parent | fd30a3237c572fc9727a4dc59edbb08b6569a761 (diff) | |
download | rails-90ee327b632f454c3cd7265be5f96a74d160c536.tar.gz rails-90ee327b632f454c3cd7265be5f96a74d160c536.tar.bz2 rails-90ee327b632f454c3cd7265be5f96a74d160c536.zip |
Merge pull request #34375 from y-yagi/add_connect_src_to_default_csp_initializer
Add `connect_src` example to content security policy initializer
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index bb3aaa9d14..32d00f3157 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -230,6 +230,14 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_equal "false\n", output end + def test_csp_initializer_include_connect_src_example + run_generator + + assert_file "config/initializers/content_security_policy.rb" do |content| + assert_match(/# policy\.connect_src/, content) + end + end + def test_app_update_keep_the_cookie_serializer_if_it_is_already_configured app_root = File.join(destination_root, "myapp") run_generator [app_root] @@ -807,6 +815,9 @@ class AppGeneratorTest < Rails::Generators::TestCase end assert_no_gem "webpacker" + assert_file "config/initializers/content_security_policy.rb" do |content| + assert_no_match(/policy\.connect_src/, content) + end end def test_webpack_option_with_js_framework |