diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/services/notification_service_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r-- | spec/services/notification_service_spec.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 743a04eabe6..032f35cfc29 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -975,10 +975,17 @@ RSpec.describe NotificationService, :mailer do end describe '#send_new_release_notifications', :deliver_mails_inline do - let(:release) { create(:release, author: current_user) } + let(:release) { create(:release, project: project, author: current_user) } let(:object) { release } let(:action) { notification.send_new_release_notifications(release) } + before_all do + build_team(project) + + update_custom_notification(:new_release, @u_guest_custom, resource: project) + update_custom_notification(:new_release, @u_custom_global) + end + context 'when release author is blocked' do let(:current_user) { create(:user, :blocked) } @@ -994,19 +1001,15 @@ RSpec.describe NotificationService, :mailer do context 'when recipients for a new release exist' do let(:current_user) { create(:user) } - it 'calls new_release_email for each relevant recipient' do - user_1 = create(:user) - user_2 = create(:user) - user_3 = create(:user) - recipient_1 = NotificationRecipient.new(user_1, :custom, custom_action: :new_release) - recipient_2 = NotificationRecipient.new(user_2, :custom, custom_action: :new_release) - allow(NotificationRecipients::BuildService).to receive(:build_new_release_recipients).and_return([recipient_1, recipient_2]) - + it 'notifies the expected users' do notification.send_new_release_notifications(release) - should_email(user_1) - should_email(user_2) - should_not_email(user_3) + should_only_email( + @u_watcher, + @u_guest_watcher, + @u_custom_global, + @u_guest_custom + ) end end end |