Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-05-27 09:44:39 +0300
committerShinya Maeda <shinya@gitlab.com>2019-05-28 05:29:59 +0300
commit7e05f3b78b6e2e892bc309105711316dc17a109d (patch)
treef72d134b613ba1815f89b1cd7dec754cbe77a8c0 /spec/lib/gitlab/data_builder
parent2b8d597f2f60243008f58ee63b2264fc72f12215 (diff)
Use source ref for pipeline webhook
When user uses Pipelines for merge requests, the pipeline is a run on a merge request ref instead of branch ref. However, we should send source ref as a webhook in order to respect the original behavior.
Diffstat (limited to 'spec/lib/gitlab/data_builder')
-rw-r--r--spec/lib/gitlab/data_builder/pipeline_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb
index 9ef987a0826..1f36fd5c6ef 100644
--- a/spec/lib/gitlab/data_builder/pipeline_spec.rb
+++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb
@@ -50,5 +50,14 @@ describe Gitlab::DataBuilder::Pipeline do
it { expect(attributes[:variables]).to be_a(Array) }
it { expect(attributes[:variables]).to contain_exactly({ key: 'TRIGGER_KEY_1', value: 'TRIGGER_VALUE_1' }) }
end
+
+ context 'when pipeline is a detached merge request pipeline' do
+ let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) }
+ let(:pipeline) { merge_request.all_pipelines.first }
+
+ it 'returns a source ref' do
+ expect(attributes[:ref]).to eq(merge_request.source_branch)
+ end
+ end
end
end