diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/services/notification_service_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index f9a89c6281e..9431c023850 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -353,7 +353,7 @@ RSpec.describe NotificationService, :mailer do context 'a service-desk issue' do before do - issue.update!(service_desk_reply_to: 'service.desk@example.com') + issue.update!(external_author: 'service.desk@example.com') project.update!(service_desk_enabled: true) end @@ -1549,6 +1549,37 @@ RSpec.describe NotificationService, :mailer do end end + describe '#issue_cloned' do + let(:new_issue) { create(:issue) } + + it 'sends email to issue notification recipients' do + notification.issue_cloned(issue, new_issue, @u_disabled) + + should_email(issue.assignees.first) + should_email(issue.author) + should_email(@u_watcher) + should_email(@u_guest_watcher) + should_email(@u_participant_mentioned) + should_email(@subscriber) + should_email(@watcher_and_subscriber) + should_not_email(@unsubscriber) + should_not_email(@u_participating) + should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + it_behaves_like 'participating notifications' do + let(:participant) { create(:user, username: 'user-participant') } + let(:issuable) { issue } + let(:notification_trigger) { notification.issue_cloned(issue, new_issue, @u_disabled) } + end + + it_behaves_like 'project emails are disabled' do + let(:notification_target) { issue } + let(:notification_trigger) { notification.issue_cloned(issue, new_issue, @u_disabled) } + end + end + describe '#issue_due' do before do issue.update!(due_date: Date.today) @@ -2326,6 +2357,20 @@ RSpec.describe NotificationService, :mailer do end end + describe '#user_admin_rejection', :deliver_mails_inline do + let_it_be(:user) { create(:user, :blocked_pending_approval) } + + before do + reset_delivered_emails! + end + + it 'sends the user a rejection email' do + notification.user_admin_rejection(user.name, user.email) + + should_only_email(user) + end + end + describe 'GroupMember', :deliver_mails_inline do let(:added_user) { create(:user) } |