diff options
Diffstat (limited to 'spec/lib')
4 files changed, 18 insertions, 4 deletions
diff --git a/spec/lib/gitlab/ci/build/policy/changes_spec.rb b/spec/lib/gitlab/ci/build/policy/changes_spec.rb index dc3329061d1..92cf0376c02 100644 --- a/spec/lib/gitlab/ci/build/policy/changes_spec.rb +++ b/spec/lib/gitlab/ci/build/policy/changes_spec.rb @@ -133,7 +133,7 @@ describe Gitlab::Ci::Build::Policy::Changes do let(:seed) { double('build seed', to_resource: ci_build) } context 'when source is merge request' do - let(:source) { :merge_request } + let(:source) { :merge_request_event } let(:merge_request) do create(:merge_request, diff --git a/spec/lib/gitlab/ci/build/policy/refs_spec.rb b/spec/lib/gitlab/ci/build/policy/refs_spec.rb index 553fc0fb9bf..b4ddbf89b70 100644 --- a/spec/lib/gitlab/ci/build/policy/refs_spec.rb +++ b/spec/lib/gitlab/ci/build/policy/refs_spec.rb @@ -68,6 +68,20 @@ describe Gitlab::Ci::Build::Policy::Refs do expect(described_class.new(%w[triggers])) .not_to be_satisfied_by(pipeline) end + + context 'when source is merge_request_event' do + let(:pipeline) { build_stubbed(:ci_pipeline, source: :merge_request_event) } + + it 'is satisfied with only: merge_request' do + expect(described_class.new(%w[merge_requests])) + .to be_satisfied_by(pipeline) + end + + it 'is not satisfied with only: merge_request_event' do + expect(described_class.new(%w[merge_request_events])) + .not_to be_satisfied_by(pipeline) + end + end end context 'when matching a ref by a regular expression' do diff --git a/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb index c9d1d09a938..3debd42ac65 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb @@ -96,7 +96,7 @@ describe Gitlab::Ci::Pipeline::Chain::Build do context 'when pipeline is running for a merge request' do let(:command) do Gitlab::Ci::Pipeline::Chain::Command.new( - source: :merge_request, + source: :merge_request_event, origin_ref: 'feature', checkout_sha: project.commit.id, after_sha: nil, @@ -117,7 +117,7 @@ describe Gitlab::Ci::Pipeline::Chain::Build do end it 'correctly indicated that this is a merge request pipeline' do - expect(pipeline).to be_merge_request + expect(pipeline).to be_merge_request_event expect(pipeline.merge_request).to eq(merge_request) end diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb index 053bc421649..e6c6a82b463 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb @@ -115,7 +115,7 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do let(:pipeline) { build_stubbed(:ci_pipeline, project: project) } let(:merge_request_pipeline) do - build(:ci_pipeline, source: :merge_request, project: project) + build(:ci_pipeline, source: :merge_request_event, project: project) end let(:chain) { described_class.new(merge_request_pipeline, command).tap(&:perform!) } |