File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -106,13 +106,15 @@ module SecureHeaders
106106 expect ( hash [ CSP ::HEADER_NAME ] ) . to eq ( "default-src 'self'; script-src mycdn.com 'unsafe-inline' anothercdn.com" )
107107 end
108108
109- it "dups global configuration just once when overriding n times" do
109+ it "dups global configuration just once when overriding n times and only calls idempotent_additions? once " do
110110 Configuration . default do |config |
111111 config . csp = {
112112 default_src : %w( 'self' )
113113 }
114114 end
115115
116+ expect ( CSP ) . to receive ( :idempotent_additions? ) . once
117+
116118 # before an override occurs, the env is empty
117119 expect ( request . env [ SECURE_HEADERS_CONFIG ] ) . to be_nil
118120
@@ -123,6 +125,8 @@ module SecureHeaders
123125 SecureHeaders . override_content_security_policy_directives ( request , script_src : %w( yet.anothercdn.com ) )
124126 current_config = SecureHeaders . config_for ( request )
125127 expect ( current_config ) . to be ( new_config )
128+
129+ SecureHeaders . header_hash_for ( request )
126130 end
127131
128132 it "overrides individual directives" do
You can’t perform that action at this time.
0 commit comments