diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-02-20 09:37:49 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-02-27 11:12:04 +0300 |
commit | 314062fec5a1d1f56a63202fa16fc7dacc876083 (patch) | |
tree | 1eccb736a2de4274ece3f9acc1c74efe9033ff8c /spec/lib/gitlab/ci/pipeline/chain/command_spec.rb | |
parent | aa77c5bd342a625c99eba8d0c1fb625b6811d412 (diff) |
Persist source sha and target sha for merge pipelines
source_sha and target_sha are used for merge request pipelines
Diffstat (limited to 'spec/lib/gitlab/ci/pipeline/chain/command_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/command_spec.rb | 48 |
1 files changed, 48 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 6aa802ce6fd..dab0fb51bcc 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb @@ -161,6 +161,54 @@ describe Gitlab::Ci::Pipeline::Chain::Command do end end + describe '#source_sha' do + subject { command.source_sha } + + let(:command) do + described_class.new(project: project, + source_sha: source_sha, + merge_request: merge_request) + end + + let(:merge_request) do + create(:merge_request, target_project: project, source_project: project) + end + + let(:source_sha) { nil } + + context 'when source_sha is specified' do + let(:source_sha) { 'abc' } + + it 'returns the specified value' do + is_expected.to eq('abc') + end + end + end + + describe '#target_sha' do + subject { command.target_sha } + + let(:command) do + described_class.new(project: project, + target_sha: target_sha, + merge_request: merge_request) + end + + let(:merge_request) do + create(:merge_request, target_project: project, source_project: project) + end + + let(:target_sha) { nil } + + context 'when target_sha is specified' do + let(:target_sha) { 'abc' } + + it 'returns the specified value' do + is_expected.to eq('abc') + end + end + end + describe '#protected_ref?' do let(:command) { described_class.new(project: project, origin_ref: 'my-branch') } |