diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-02-14 15:25:10 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-02-25 13:40:15 +0900 |
commit | 7ba89e4ac40afb4ed16865b0c3ac286217c2d64c (patch) | |
tree | 7a222f0b1904c43e96f21b36c05d843855aea27b /spec/presenters/ci | |
parent | 9428db8ec834ada489c921ba1025b16af97e827f (diff) | |
download | gitlab-ce-7ba89e4ac40afb4ed16865b0c3ac286217c2d64c.tar.gz |
Expose refspec and depth to runner
fix
fix and fix
Allow full ref specification for pipeline creation
Add spec
Support backward compatibility
Use ref path
Runner feature flag
Simplify the things
Support fork workflow (Public only)
Expose ref spec
Use refspec
Glooming
Decouple unrelated changes
Add changelog
Revert unrelated file
Decouple unnecessary
Add spec
Use refspecs
Fix changelog
Simplify
Fix coding offence
Fix
a
ok
ok
ok
ok
ok
a
a
Fix
Add workaround for ignore_column
Fix git depth
Fix coding offence
Fix spec
Simplify more
Do not set ignored column
Fix tests
Fix pipeline
Fix spec
fix fixture yes
Revert nonsense
fix
Revert more
ok
Decouple mr pipelines
fix spev
Remove unrelated changes
Diffstat (limited to 'spec/presenters/ci')
-rw-r--r-- | spec/presenters/ci/build_runner_presenter_spec.rb | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/spec/presenters/ci/build_runner_presenter_spec.rb b/spec/presenters/ci/build_runner_presenter_spec.rb index 170e0ac5717..f50bcf54b46 100644 --- a/spec/presenters/ci/build_runner_presenter_spec.rb +++ b/spec/presenters/ci/build_runner_presenter_spec.rb @@ -98,4 +98,72 @@ describe Ci::BuildRunnerPresenter do end end end + + describe '#ref_type' do + subject { presenter.ref_type } + + let(:build) { create(:ci_build, tag: tag) } + let(:tag) { true } + + it 'returns the correct ref type' do + is_expected.to eq('tag') + end + + context 'when tag is false' do + let(:tag) { false } + + it 'returns the correct ref type' do + is_expected.to eq('branch') + end + end + end + + describe '#git_depth' do + subject { presenter.git_depth } + + let(:build) { create(:ci_build) } + + it 'returns the correct git depth' do + is_expected.to eq(0) + end + + context 'when GIT_DEPTH variable is specified' do + before do + create(:ci_pipeline_variable, key: 'GIT_DEPTH', value: 1, pipeline: build.pipeline) + end + + it 'returns the correct git depth' do + is_expected.to eq(1) + end + end + end + + describe '#refspecs' do + subject { presenter.refspecs } + + let(:build) { create(:ci_build) } + + it 'returns the correct refspecs' do + is_expected.to contain_exactly('+refs/tags/*:refs/tags/*', + '+refs/heads/*:refs/remotes/origin/*') + end + + context 'when GIT_DEPTH variable is specified' do + before do + create(:ci_pipeline_variable, key: 'GIT_DEPTH', value: 1, pipeline: build.pipeline) + end + + it 'returns the correct refspecs' do + is_expected.to contain_exactly("+refs/heads/#{build.ref}:refs/remotes/origin/#{build.ref}") + end + + context 'when ref is tag' do + let(:build) { create(:ci_build, :tag) } + + it 'returns the correct refspecs' do + is_expected.to contain_exactly("+refs/tags/#{build.ref}:refs/tags/#{build.ref}") + end + end + end + end end |