diff options
author | Nick Thomas <nick@gitlab.com> | 2016-08-15 16:47:16 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-08-15 16:47:16 +0300 |
commit | 6642ae4579d6ceed6b26014aee4a22adb39fc43c (patch) | |
tree | f22f9704185059cfd49e65488bdb44174fce478d /spec/services/notification_service_spec.rb | |
parent | b450aab8501076740cd7140b47488b9dfa5f58f9 (diff) |
Add notifications for new user mentions in merge requests
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index d61de6c15d1..2fa0d9f1ac2 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -789,6 +789,32 @@ describe NotificationService, services: true do end end + describe '#new_mentions_in_merge_request' do + def send_notifications(*new_mentions) + ActionMailer::Base.deliveries.clear + notification.new_mentions_in_merge_request(merge_request, new_mentions, @u_disabled) + end + + it "should not email anyone unless they are newly mentioned" do + send_notifications + expect(ActionMailer::Base.deliveries).to eq [] + end + + it "should email new mentions with a watch level higher than participant" do + send_notifications(@u_watcher, @u_participant_mentioned) + + should_email(@u_watcher) + should_email(@u_participant_mentioned) + + expect(ActionMailer::Base.deliveries.count).to eq 2 + end + + it "should not email new mentions with a watch level equal to or less than participant" do + send_notifications(@u_participating, @u_mentioned) + expect(ActionMailer::Base.deliveries).to eq [] + end + end + describe '#reassigned_merge_request' do before do update_custom_notification(:reassign_merge_request, @u_guest_custom, project) |