Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/content_security_policy_helpers.rb')
-rw-r--r--spec/support/helpers/content_security_policy_helpers.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/support/helpers/content_security_policy_helpers.rb b/spec/support/helpers/content_security_policy_helpers.rb
index 230075ead70..7e3de9fd219 100644
--- a/spec/support/helpers/content_security_policy_helpers.rb
+++ b/spec/support/helpers/content_security_policy_helpers.rb
@@ -4,11 +4,17 @@ module ContentSecurityPolicyHelpers
# Expecting 2 calls to current_content_security_policy by default:
# 1. call that's being tested
# 2. call in ApplicationController
- def setup_csp_for_controller(controller_class, csp = ActionDispatch::ContentSecurityPolicy.new, times: 2)
+ def setup_csp_for_controller(
+ controller_class, csp = ActionDispatch::ContentSecurityPolicy.new, times: 2,
+any_time: false)
expect_next_instance_of(controller_class) do |controller|
- expect(controller)
+ if any_time
+ expect(controller).to receive(:current_content_security_policy).at_least(:once).and_return(csp)
+ else
+ expect(controller)
.to receive(:current_content_security_policy).exactly(times).times
.and_return(csp)
+ end
end
end
end