diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-11-15 21:28:17 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-12-08 19:28:34 +0100 |
commit | 837ab8c5d83243db8efe1cec1c6e001d1cbeb43f (patch) | |
tree | cf2dc96a8f526f428090e36f2bf6c93b1f236b5c /spec/models/concerns | |
parent | 2edc02143b2d361275fb97ce2904a58e7dc8ff38 (diff) | |
download | gitlab-ce-837ab8c5d83243db8efe1cec1c6e001d1cbeb43f.tar.gz |
Make HasRef#git_ref public
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/has_ref_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/concerns/has_ref_spec.rb b/spec/models/concerns/has_ref_spec.rb index ec3cf9a8580..14db197dfe0 100644 --- a/spec/models/concerns/has_ref_spec.rb +++ b/spec/models/concerns/has_ref_spec.rb @@ -28,4 +28,32 @@ describe HasRef do end end end + + describe '#git_ref' do + subject { pipeline.git_ref } + + context 'when tag is true' do + let(:pipeline) { create(:ci_pipeline, tag: true) } + + it 'returns a tag ref' do + is_expected.to start_with(Gitlab::Git::TAG_REF_PREFIX) + end + end + + context 'when tag is false' do + let(:pipeline) { create(:ci_pipeline, tag: false) } + + it 'returns a branch ref' do + is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX) + end + end + + context 'when tag is nil' do + let(:pipeline) { create(:ci_pipeline, tag: nil) } + + it 'returns a branch ref' do + is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX) + end + end + end end |