diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-29 14:34:41 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-29 14:34:41 +0300 |
commit | dadc046d3a5c797294330bcd26acdadac069c9cc (patch) | |
tree | 3468d1ca9b320315f3d4d5e5e032e6d547cc2550 /spec/serializers/merge_request_widget_entity_spec.rb | |
parent | 289651e26f5b18cc68dcdd052939cd878ca66092 (diff) |
post merge pipeline and environments status
Diffstat (limited to 'spec/serializers/merge_request_widget_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_widget_entity_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb index 5bf8aa7f23f..561421d5ac8 100644 --- a/spec/serializers/merge_request_widget_entity_spec.rb +++ b/spec/serializers/merge_request_widget_entity_spec.rb @@ -52,6 +52,40 @@ describe MergeRequestWidgetEntity do end end + describe 'merge_pipeline' do + it 'returns nil' do + expect(subject[:merge_pipeline]).to be_nil + end + + context 'when is merged' do + let(:resource) { create(:merged_merge_request, source_project: project, merge_commit_sha: project.commit.id) } + let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: resource.target_branch, sha: resource.merge_commit_sha) } + + before do + project.add_maintainer(user) + end + + it 'returns merge_pipeline' do + pipeline.reload + pipeline_payload = PipelineDetailsEntity + .represent(pipeline, request: request) + .as_json + + expect(subject[:merge_pipeline]).to eq(pipeline_payload) + end + + context 'when user cannot read pipelines on target project' do + before do + project.add_guest(user) + end + + it 'returns nil' do + expect(subject[:merge_pipeline]).to be_nil + end + end + end + end + describe 'metrics' do context 'when metrics record exists with merged data' do before do |