Commit b54ae4eb authored by Etienne Baqué's avatar Etienne Baqué

Merge branch '300750-add-missing-reviewers-information-to-merged-merge-request-email' into 'master'

Add reviewers detail to merged merge request email

See merge request gitlab-org/gitlab!55589
parents 14addedb 7b8c75b8
...@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m ...@@ -6,3 +6,4 @@ Merge Request URL: #{project_merge_request_url(@merge_request.target_project, @m
Author: #{sanitize_name(@merge_request.author_name)} Author: #{sanitize_name(@merge_request.author_name)}
= assignees_label(@merge_request) = assignees_label(@merge_request)
= reviewers_label(@merge_request)
---
title: Add reviewers detail to merged merge request email
merge_request: 55589
author:
type: added
...@@ -6,7 +6,8 @@ require 'email_spec' ...@@ -6,7 +6,8 @@ require 'email_spec'
RSpec.describe Emails::MergeRequests do RSpec.describe Emails::MergeRequests do
include EmailSpec::Matchers include EmailSpec::Matchers
let_it_be(:recipient) { create(:user) } include_context 'gitlab email notification'
let_it_be(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
let_it_be(:assignee, reload: true) { create(:user, email: 'assignee@example.com', name: 'John Doe') } let_it_be(:assignee, reload: true) { create(:user, email: 'assignee@example.com', name: 'John Doe') }
let_it_be(:reviewer, reload: true) { create(:user, email: 'reviewer@example.com', name: 'Jane Doe') } let_it_be(:reviewer, reload: true) { create(:user, email: 'reviewer@example.com', name: 'Jane Doe') }
...@@ -20,6 +21,42 @@ RSpec.describe Emails::MergeRequests do ...@@ -20,6 +21,42 @@ RSpec.describe Emails::MergeRequests do
description: 'Awesome description') description: 'Awesome description')
end end
let(:recipient) { assignee }
describe '#merged_merge_request_email' do
let(:merge_author) { assignee }
subject { Notify.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) }
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
let(:model) { merge_request }
end
it_behaves_like 'it should show Gmail Actions View Merge request link'
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
it 'is sent as the merge author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(merge_author.name)
expect(sender.address).to eq(gitlab_sender)
end
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_body_text('merged')
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_link(merge_request.to_reference, href: project_merge_request_url(merge_request.target_project, merge_request))
expect(subject.text_part).to have_content(assignee.name)
expect(subject.text_part).to have_content(reviewer.name)
end
end
end
describe "#merge_when_pipeline_succeeds_email" do describe "#merge_when_pipeline_succeeds_email" do
let(:title) { "Merge request #{merge_request.to_reference} was scheduled to merge after pipeline succeeds by #{current_user.name}" } let(:title) { "Merge request #{merge_request.to_reference} was scheduled to merge after pipeline succeeds by #{current_user.name}" }
......
...@@ -495,37 +495,6 @@ RSpec.describe Notify do ...@@ -495,37 +495,6 @@ RSpec.describe Notify do
end end
end end
describe 'that are merged' do
let(:merge_author) { create(:user) }
subject { described_class.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) }
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
let(:model) { merge_request }
end
it_behaves_like 'it should show Gmail Actions View Merge request link'
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
it 'is sent as the merge author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(merge_author.name)
expect(sender.address).to eq(gitlab_sender)
end
it 'has the correct subject and body' do
aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_body_text('merged')
is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_link(merge_request.to_reference, href: project_merge_request_url(merge_request.target_project, merge_request))
end
end
end
describe 'that are unmergeable' do describe 'that are unmergeable' do
let_it_be(:merge_request) do let_it_be(:merge_request) do
create(:merge_request, :conflict, create(:merge_request, :conflict,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment