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/shared_examples/services/protected_branches_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/services/protected_branches_shared_examples.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/support/shared_examples/services/protected_branches_shared_examples.rb b/spec/support/shared_examples/services/protected_branches_shared_examples.rb
index ce607a6b956..15c63865720 100644
--- a/spec/support/shared_examples/services/protected_branches_shared_examples.rb
+++ b/spec/support/shared_examples/services/protected_branches_shared_examples.rb
@@ -1,11 +1,24 @@
# frozen_string_literal: true
RSpec.shared_context 'with scan result policy blocking protected branches' do
+ include RepoHelpers
+
+ let(:policy_path) { Security::OrchestrationPolicyConfiguration::POLICY_PATH }
+ let_it_be(:policy_project) { create(:project, :repository) }
+ let(:default_branch) { policy_project.default_branch }
+
+ let(:policy_yaml) do
+ build(:orchestration_policy_yaml, scan_execution_policy: [], scan_result_policy: [scan_result_policy])
+ end
+
+ let(:scan_result_policy) do
+ build(:scan_result_policy, branches: [branch_name], approval_settings: { block_unprotecting_branches: true })
+ end
+
before do
- create(
- :scan_result_policy_read,
- :blocking_protected_branches,
- project: project)
+ policy_configuration.update_attribute(:security_policy_management_project, policy_project)
+
+ create_file_in_repo(policy_project, default_branch, default_branch, policy_path, policy_yaml)
stub_licensed_features(security_orchestration_policies: true)
end