diff options
Diffstat (limited to 'qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb')
-rw-r--r-- | qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb index 40a8be8202a..4bbad9bf3e5 100644 --- a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb +++ b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb @@ -31,19 +31,13 @@ module QA end # Require approval from code owners on the default branch - # The default branch is already protected, and we can't update a protected branch via the API (yet) - # so we unprotect it first and then protect it again with the desired parameters - Resource::ProtectedBranch.unprotect_via_api! do |protected_branch| - protected_branch.project = project - protected_branch.branch_name = project.default_branch - end - - Resource::ProtectedBranch.fabricate_via_api! do |protected_branch| - protected_branch.project = project - protected_branch.branch_name = project.default_branch - protected_branch.new_branch = false - protected_branch.require_code_owner_approval = true + protected_branch = Resource::ProtectedBranch.fabricate_via_api! do |branch| + branch.project = project + branch.branch_name = project.default_branch + branch.new_branch = false + branch.require_code_owner_approval = true end + protected_branch.set_require_code_owner_approval # Push a change to the file with a CODEOWNERS rule Resource::Repository::Push.fabricate! do |push| |