diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 12:09:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 12:09:20 +0000 |
commit | b84eeb256c4a780d902faee1f99ca9a711b3214a (patch) | |
tree | 32918aadbea9210eace50efbce9afbfb8cd3ba84 /spec/mailers | |
parent | 53ae6b7e3f83591ad251a3f771f5bf3b8cf087ba (diff) | |
download | gitlab-ce-b84eeb256c4a780d902faee1f99ca9a711b3214a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/pipelines_spec.rb | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/mailers/emails/pipelines_spec.rb b/spec/mailers/emails/pipelines_spec.rb index 8d4afe9f00f..ad1aa915fbb 100644 --- a/spec/mailers/emails/pipelines_spec.rb +++ b/spec/mailers/emails/pipelines_spec.rb @@ -19,6 +19,25 @@ describe Emails::Pipelines do expect(subject).to have_body_text status_text end + context 'when pipeline on master branch has a merge request' do + let(:pipeline) { create(:ci_pipeline, ref: 'master', sha: sha, project: project) } + + let!(:merge_request) do + create(:merge_request, source_branch: 'master', target_branch: 'feature', + source_project: project, target_project: project) + end + + it 'has correct information that there is no merge request link' do + expect(subject) + .to have_subject "#{project.name} | Pipeline ##{pipeline.id} has " \ + "#{status} for #{pipeline.source_ref} | " \ + "#{pipeline.short_sha}".to_s + + expect(subject).to have_body_text pipeline.source_ref + expect(subject).to have_body_text status_text + end + end + context 'when pipeline for merge requests' do let(:pipeline) { merge_request.all_pipelines.first } @@ -28,7 +47,7 @@ describe Emails::Pipelines do target_project: project) end - it 'has a correct information with merge request link' do + it 'has correct information that there is a merge request link' do expect(subject) .to have_subject "#{project.name} | Pipeline ##{pipeline.id} has " \ "#{status} for #{pipeline.source_ref} | " \ @@ -39,6 +58,27 @@ describe Emails::Pipelines do expect(subject).not_to have_body_text pipeline.ref end end + + context 'when branch pipeline is set to a merge request as a head pipeline' do + let(:pipeline) do + create(:ci_pipeline, project: project, ref: ref, sha: sha, + merge_requests_as_head_pipeline: [merge_request]) + end + + let(:merge_request) do + create(:merge_request, source_project: project, target_project: project) + end + + it 'has correct information that there is a merge request link' do + expect(subject) + .to have_subject "#{project.name} | Pipeline ##{pipeline.id} has " \ + "#{status} for #{pipeline.source_ref} | " \ + "#{pipeline.short_sha} in !#{merge_request.iid}".to_s + + expect(subject).to have_body_text merge_request.to_reference + expect(subject).to have_body_text pipeline.source_ref + end + end end describe '#pipeline_success_email' do |