summaryrefslogtreecommitdiff
path: root/spec/services/notification_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r--spec/services/notification_service_spec.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index aa67b87a645..25900043f11 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -682,7 +682,7 @@ describe NotificationService, :mailer do
context 'when recipients for a new release exist' do
let(:release) { create(:release) }
- it 'calls new_release_email for each relevant recipient' do
+ it 'calls new_release_email for each relevant recipient', :sidekiq_might_not_need_inline do
user_1 = create(:user)
user_2 = create(:user)
user_3 = create(:user)
@@ -869,6 +869,18 @@ describe NotificationService, :mailer do
should_email(user_4)
end
+ it 'adds "subscribed" reason to subscriber emails' do
+ user_1 = create(:user)
+ label = create(:label, project: project, issues: [issue])
+ issue.reload
+ label.subscribe(user_1)
+
+ notification.new_issue(issue, @u_disabled)
+
+ email = find_email_for(user_1)
+ expect(email).to have_header('X-GitLab-NotificationReason', NotificationReason::SUBSCRIBED)
+ end
+
it_behaves_like 'project emails are disabled' do
let(:notification_target) { issue }
let(:notification_trigger) { notification.new_issue(issue, @u_disabled) }
@@ -1272,6 +1284,17 @@ describe NotificationService, :mailer do
let(:notification_target) { issue }
let(:notification_trigger) { notification.close_issue(issue, @u_disabled) }
end
+
+ it 'adds "subscribed" reason to subscriber emails' do
+ user_1 = create(:user)
+ issue.subscribe(user_1)
+ issue.reload
+
+ notification.close_issue(issue, @u_disabled)
+
+ email = find_email_for(user_1)
+ expect(email).to have_header('X-GitLab-NotificationReason', NotificationReason::SUBSCRIBED)
+ end
end
describe '#reopen_issue' do