diff options
author | Bian Jiaping <ssbianjp@gmail.com> | 2019-09-11 22:33:45 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-09-11 22:33:45 +0300 |
commit | 9c0e2d5b47c09eba83c3f73d4b01e2b27378cb4d (patch) | |
tree | 1badc87a7dfc63d4cb1b53c120e1dbb6ef0dbde4 /spec/lib/gitlab/data_builder | |
parent | 3fb68248921b6002f55f2b1f8c97ed1aaf9600d6 (diff) |
Add source and merge_request fields to pipeline event webhook
Diffstat (limited to 'spec/lib/gitlab/data_builder')
-rw-r--r-- | spec/lib/gitlab/data_builder/pipeline_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index 4afb7195b7b..931477d19c2 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -28,12 +28,14 @@ describe Gitlab::DataBuilder::Pipeline do expect(attributes[:sha]).to eq(pipeline.sha) expect(attributes[:tag]).to eq(pipeline.tag) expect(attributes[:id]).to eq(pipeline.id) + expect(attributes[:source]).to eq(pipeline.source) expect(attributes[:status]).to eq(pipeline.status) expect(attributes[:detailed_status]).to eq('passed') expect(build_data).to be_a(Hash) expect(build_data[:id]).to eq(build.id) expect(build_data[:status]).to eq(build.status) expect(project_data).to eq(project.hook_attrs(backward: false)) + expect(data[:merge_request]).to be_nil end context 'pipeline without variables' do @@ -60,6 +62,22 @@ describe Gitlab::DataBuilder::Pipeline do it 'returns a source ref' do expect(attributes[:ref]).to eq(merge_request.source_branch) end + + it 'returns merge request' do + merge_request_attrs = data[:merge_request] + + expect(merge_request_attrs).to be_a(Hash) + expect(merge_request_attrs[:id]).to eq(merge_request.id) + expect(merge_request_attrs[:iid]).to eq(merge_request.iid) + expect(merge_request_attrs[:title]).to eq(merge_request.title) + expect(merge_request_attrs[:source_branch]).to eq(merge_request.source_branch) + expect(merge_request_attrs[:source_project_id]).to eq(merge_request.source_project_id) + expect(merge_request_attrs[:target_branch]).to eq(merge_request.target_branch) + expect(merge_request_attrs[:target_project_id]).to eq(merge_request.target_project_id) + expect(merge_request_attrs[:state]).to eq(merge_request.state) + expect(merge_request_attrs[:merge_status]).to eq(merge_request.merge_status) + expect(merge_request_attrs[:url]).to eq("http://localhost/#{merge_request.target_project.full_path}/merge_requests/#{merge_request.iid}") + end end end end |