diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-03-07 09:09:37 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-03-07 12:47:31 +0800 |
commit | 333097d7652a863f1d328e4c6b86be5e3b570bbf (patch) | |
tree | 6e0b63ca34171a1d28248d262716c1bdaa988f1a /spec/lib/gitlab/checks | |
parent | 20805bedfcb2de15a661c327d29b1305367d6167 (diff) | |
download | gitlab-ce-333097d7652a863f1d328e4c6b86be5e3b570bbf.tar.gz |
Allow protected branch creation for empty project
Diffstat (limited to 'spec/lib/gitlab/checks')
-rw-r--r-- | spec/lib/gitlab/checks/branch_check_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/checks/branch_check_spec.rb b/spec/lib/gitlab/checks/branch_check_spec.rb index f99fc639dbd..1a672f9d80a 100644 --- a/spec/lib/gitlab/checks/branch_check_spec.rb +++ b/spec/lib/gitlab/checks/branch_check_spec.rb @@ -116,6 +116,21 @@ describe Gitlab::Checks::BranchCheck do .and_return(['branch']) end + context "when repo is empty" do + let(:project) { create(:project, :empty_repo) } + let(:ref) { 'refs/heads/master' } + + before do + allow(user_access) + .to receive(:can_push_to_branch?) + .and_return(true) + end + + it 'allows branch creation' do + expect { subject.validate! }.not_to raise_error + end + end + context "newrev isn't in any protected branches" do before do allow(ProtectedBranch) |