diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-07-18 14:22:25 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-18 14:22:25 +0300 |
commit | 1ba47de5fef7a86a453e97a574741d3dba85c521 (patch) | |
tree | 76e4175ac67372c6343e190d5e89df00f122f297 /spec/lib/gitlab/checks | |
parent | c35089d6658d19efe0b7a700d63dcce7866093bf (diff) | |
parent | 65e5cf0ace9cb57b474656633d2bee8bbebc940f (diff) |
Merge branch '27456-improve-feedback-when-dev-cannot-push-to-empty-repo' into 'master'
Improve feedback when a developer cannot push in an empty repository
Closes #27456
See merge request gitlab-org/gitlab-ce!20519
Diffstat (limited to 'spec/lib/gitlab/checks')
-rw-r--r-- | spec/lib/gitlab/checks/change_access_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/checks/change_access_spec.rb b/spec/lib/gitlab/checks/change_access_spec.rb index 7c04aa27971..4df426c54ae 100644 --- a/spec/lib/gitlab/checks/change_access_spec.rb +++ b/spec/lib/gitlab/checks/change_access_spec.rb @@ -132,6 +132,16 @@ describe Gitlab::Checks::ChangeAccess do expect { subject.exec }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to push code to protected branches on this project.') end + context 'when project repository is empty' do + let(:project) { create(:project) } + + it 'raises an error if the user is not allowed to push to protected branches' do + expect(user_access).to receive(:can_push_to_branch?).and_return(false) + + expect { subject.exec }.to raise_error(Gitlab::GitAccess::UnauthorizedError, /Ask a project Owner or Maintainer to create a default branch/) + end + end + context 'branch deletion' do let(:newrev) { '0000000000000000000000000000000000000000' } let(:ref) { 'refs/heads/feature' } |