summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-05-02 11:10:07 -0700
committerMichael Kozono <mkozono@gmail.com>2018-06-08 09:05:06 -0700
commitb8a031e54a46735d93ac932a25835a8bdfd9824d (patch)
tree0984cd2d07f3925d66b250d1ca01eb9787ba3fc6 /qa
parentebdc7f11d9c1a2a492e4af6918d407882ce5737d (diff)
downloadgitlab-ce-b8a031e54a46735d93ac932a25835a8bdfd9824d.tar.gz
Add test for authorized push to protected branch
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/specs/features/repository/protected_branches_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/qa/qa/specs/features/repository/protected_branches_spec.rb b/qa/qa/specs/features/repository/protected_branches_spec.rb
index efe7863dc87..40c810605ba 100644
--- a/qa/qa/specs/features/repository/protected_branches_spec.rb
+++ b/qa/qa/specs/features/repository/protected_branches_spec.rb
@@ -66,5 +66,31 @@ module QA
.to match(/\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/)
end
end
+
+ scenario 'users with authorization can push to protected branch' do
+ Factory::Resource::Branch.fabricate! do |resource|
+ resource.branch_name = branch_name
+ resource.project = project
+ resource.allow_to_push = true
+ resource.protected = true
+ end
+
+ project.visit!
+
+ Git::Repository.perform do |repository|
+ repository.uri = location.uri
+ repository.use_default_credentials
+
+ repository.act do
+ clone
+ configure_identity('GitLab QA', 'root@gitlab.com')
+ checkout('protected-branch')
+ commit_file('README.md', 'readme content', 'Add a readme')
+ push_changes('protected-branch')
+ end
+
+ expect(repository.push_output).to match(/remote: To create a merge request for protected-branch, visit/)
+ end
+ end
end
end