summaryrefslogtreecommitdiff
path: root/spec/mailers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-05-24 08:49:54 +0000
committerDouwe Maan <douwe@gitlab.com>2018-05-24 08:49:54 +0000
commite97a87433b2f55b2f688771cbe47d627f49d4b44 (patch)
tree68b698985cca79d2d9b1351ec186b356e5e3bec2 /spec/mailers
parent56d2d462271da802a0126fa588f7ae76ae18f09f (diff)
parent13aa6f6740118743e47f24f01aa54fed30079f4d (diff)
downloadgitlab-ce-e97a87433b2f55b2f688771cbe47d627f49d4b44.tar.gz
Merge branch 'mr-conflict-notification' into 'master'
MR unmergeable notification See merge request gitlab-org/gitlab-ce!18042
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/notify_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 8a52c151cc4..f310a6854d5 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -390,6 +390,46 @@ describe Notify do
end
end
+ describe 'that are unmergeable' do
+ set(:merge_request) do
+ create(:merge_request, :conflict,
+ source_project: project,
+ target_project: project,
+ author: current_user,
+ assignee: assignee,
+ description: 'Awesome description')
+ end
+
+ subject { described_class.merge_request_unmergeable_email(recipient.id, merge_request.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 'is sent as the merge request author' do
+ sender = subject.header[:from].addrs[0]
+ expect(sender.display_name).to eq(merge_request.author.name)
+ expect(sender.address).to eq(gitlab_sender)
+ end
+
+ it 'has the correct subject and body' do
+ reasons = %w[foo bar]
+
+ allow_any_instance_of(MergeRequestPresenter).to receive(:unmergeable_reasons).and_return(reasons)
+ aggregate_failures do
+ is_expected.to have_referable_subject(merge_request, reply: true)
+ is_expected.to have_body_text(project_merge_request_path(project, merge_request))
+ is_expected.to have_body_text('reasons:')
+ reasons.each do |reason|
+ is_expected.to have_body_text(reason)
+ end
+ end
+ end
+ end
+
shared_examples 'a push to an existing merge request' do
let(:push_user) { create(:user) }