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:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-01-05 14:40:54 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-01-13 18:53:59 +0300
commiteb9b96405498e37b25aa32876b0e101d1880f4e9 (patch)
tree007d1372f4b2b9429bdc9f32c54e2e72ed994658 /spec/lib/gitlab/user_access_spec.rb
parentc3c053def2e59300211d33834701e6519659b0c6 (diff)
Allow creating protected branch when it doesn't exist
if user has either push or merge permissions + Change log entry for fix to creating a branch matching a wildcard fails
Diffstat (limited to 'spec/lib/gitlab/user_access_spec.rb')
-rw-r--r--spec/lib/gitlab/user_access_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb
index d3c3b800b94..369e55f61f1 100644
--- a/spec/lib/gitlab/user_access_spec.rb
+++ b/spec/lib/gitlab/user_access_spec.rb
@@ -66,7 +66,8 @@ describe Gitlab::UserAccess, lib: true do
end
describe 'push to protected branch' do
- let(:branch) { create :protected_branch, project: project }
+ let(:branch) { create :protected_branch, project: project, name: "test" }
+ let(:not_existing_branch) { create :protected_branch, :developers_can_merge, project: project }
it 'returns true if user is a master' do
project.team << [user, :master]
@@ -85,6 +86,12 @@ describe Gitlab::UserAccess, lib: true do
expect(access.can_push_to_branch?(branch.name)).to be_falsey
end
+
+ it 'returns true if branch does not exist and user has permission to merge' do
+ project.team << [user, :developer]
+
+ expect(access.can_push_to_branch?(not_existing_branch.name)).to be_truthy
+ end
end
describe 'push to protected branch if allowed for developers' do