Commit 1374e3ee authored by David Kim's avatar David Kim Committed by Dylan Griffith

Add reviewers detail to closed merge request email

parent d8a891a9
...@@ -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 text version of closed merge request email
merge_request: 55594
author:
type: added
...@@ -8,7 +8,7 @@ RSpec.describe Emails::MergeRequests do ...@@ -8,7 +8,7 @@ RSpec.describe Emails::MergeRequests do
include_context 'gitlab email notification' include_context 'gitlab email notification'
let_it_be(:current_user) { create(:user) } let_it_be(:current_user, reload: true) { create(:user, email: "current@email.com", name: 'www.example.com') }
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') }
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
...@@ -22,6 +22,39 @@ RSpec.describe Emails::MergeRequests do ...@@ -22,6 +22,39 @@ RSpec.describe Emails::MergeRequests do
end end
let(:recipient) { assignee } let(:recipient) { assignee }
let(:current_user_sanitized) { 'www_example_com' }
describe '#closed_merge_request_email' do
subject { Notify.closed_merge_request_email(recipient.id, merge_request.id, current_user.id) }
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 author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(current_user.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('closed')
is_expected.to have_body_text(current_user_sanitized)
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 '#merged_merge_request_email' do describe '#merged_merge_request_email' do
let(:merge_author) { assignee } let(:merge_author) { assignee }
...@@ -79,7 +112,7 @@ RSpec.describe Emails::MergeRequests do ...@@ -79,7 +112,7 @@ RSpec.describe Emails::MergeRequests do
subject { Notify.resolved_all_discussions_email(recipient.id, merge_request.id, current_user.id) } subject { Notify.resolved_all_discussions_email(recipient.id, merge_request.id, current_user.id) }
it "includes the name of the resolver" do it "includes the name of the resolver" do
expect(subject).to have_body_text current_user.name expect(subject).to have_body_text current_user_sanitized
end end
end end
......
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