summaryrefslogtreecommitdiff
path: root/spec/services/notification_service_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-05 12:06:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-05 12:06:20 +0000
commit791785af5540d18eaa97da24f9ff8638e1960b72 (patch)
treecaeb6f08d9cc10a0052dc6851b46653d94c29022 /spec/services/notification_service_spec.rb
parenta92d6b36c2d2892e8c070efb169f0c06815900ee (diff)
downloadgitlab-ce-791785af5540d18eaa97da24f9ff8638e1960b72.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/notification_service_spec.rb')
-rw-r--r--spec/services/notification_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 2481cd5c006..25900043f11 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -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