summaryrefslogtreecommitdiff
path: root/spec/mailers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-04-03 12:51:09 +0100
committerSean McGivern <sean@gitlab.com>2018-04-03 13:22:25 +0100
commit682eb7583499c4720422469ef4cd86fa48728263 (patch)
tree65ffa84335ba25fca446b5fbf974a08a10bd8a16 /spec/mailers
parent98278abd590198832c09445ee69df4df6cd006a2 (diff)
downloadgitlab-ce-682eb7583499c4720422469ef4cd86fa48728263.tar.gz
Fix body of email when commits are pushed to an MR
This was sending the current user, which is the recipient! It should be the user who pushed the commits.
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/notify_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 83c33797bbc..971a88e9ee9 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -389,6 +389,36 @@ describe Notify do
end
end
end
+
+ describe 'that have new commits' do
+ let(:push_user) { create(:user) }
+
+ subject do
+ described_class.push_to_merge_request_email(recipient.id, merge_request.id, push_user.id, new_commits: merge_request.commits)
+ end
+
+ 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 'is sent as the push user' do
+ sender = subject.header[:from].addrs[0]
+
+ expect(sender.display_name).to eq(push_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("#{push_user.name} pushed new commits")
+ is_expected.to have_body_text(project_merge_request_path(project, merge_request))
+ end
+ end
+ end
end
context 'for issue notes' do