summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-26 15:43:46 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-12-08 19:28:56 +0100
commita1be58097943f7f568de6a90aa12cf7452ac2f0a (patch)
tree00bb9628462db4690b6898b1c0e1fb528ee3722a /spec/lib/gitlab
parent9f6d228d2368911befc11038d64ccb9ccae131ad (diff)
downloadgitlab-ce-a1be58097943f7f568de6a90aa12cf7452ac2f0a.tar.gz
Implement Command#ambiguous_ref?
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/command_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
index 75a177d2d1f..6aa802ce6fd 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
@@ -182,4 +182,24 @@ describe Gitlab::Ci::Pipeline::Chain::Command do
it { is_expected.to eq(false) }
end
end
+
+ describe '#ambiguous_ref' do
+ let(:project) { create(:project, :repository) }
+ let(:command) { described_class.new(project: project, origin_ref: 'ref') }
+
+ subject { command.ambiguous_ref? }
+
+ context 'when ref is not ambiguous' do
+ it { is_expected. to eq(false) }
+ end
+
+ context 'when ref is ambiguous' do
+ before do
+ project.repository.add_tag(project.creator, 'ref', 'master')
+ project.repository.add_branch(project.creator, 'ref', 'master')
+ end
+
+ it { is_expected. to eq(true) }
+ end
+ end
end