summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-15 23:31:02 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-12-08 19:28:34 +0100
commitb0b5924eb418851ddfab848ab16b6acac27d42e0 (patch)
tree23a7418007019f94923a4a33dbb0ff1c4d4b7461 /spec/models/project_spec.rb
parent855e7c32b9f3541fec085726d338802c8ca9b9f4 (diff)
downloadgitlab-ce-b0b5924eb418851ddfab848ab16b6acac27d42e0.tar.gz
Use nil instead of raising AmbiguousRef
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index e2e8a76ab72..48cf693b678 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2571,6 +2571,14 @@ describe Project do
allow(project).to receive(:resolve_ref).and_return(ref)
end
+ context 'when ref is ambiguous' do
+ let(:ref) { nil }
+
+ it 'returns false' do
+ is_expected.to be_falsey
+ end
+ end
+
context 'when the ref is not protected' do
let(:ref) { project.repository.find_branch('master') }
@@ -2820,8 +2828,8 @@ describe Project do
project.repository.add_branch(project.creator, ref, 'master')
end
- it 'raises an error' do
- expect { subject }.to raise_error(described_class::AmbiguousRef)
+ it 'returns nil' do
+ is_expected.to eq(nil)
end
end