diff options
author | Nick Thomas <nick@gitlab.com> | 2016-08-13 00:54:32 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-08-13 00:54:32 +0300 |
commit | 59bfa0809822c3dd257748197223809922ab5f80 (patch) | |
tree | 8c5d247402532e0995f7f9f25203c6e787c3ed74 /spec/services/notification_service_spec.rb | |
parent | b2828d4145ac01468a59b821ced29dd248526089 (diff) |
Send notification emails when users are newly mentioned in issue edits
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 92b441c28ca..1935451ff12 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -399,6 +399,32 @@ describe NotificationService, services: true do end end + describe '#new_mentions_in_issue' do + def send_notifications(*new_mentions) + ActionMailer::Base.deliveries.clear + notification.new_mentions_in_issue(issue, 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_issue' do before do update_custom_notification(:reassign_issue, @u_guest_custom, project) |