summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-05-06 16:40:27 -0300
committerFelipe Artur <felipefac@gmail.com>2016-05-17 21:53:04 -0500
commitc2c7014e017a36e2819335653f5d3fc04cc2c054 (patch)
treed245e4a242a03be141ef85c08039f0df00a04d47 /spec
parent07ff874f572a947d7730787492a604dd3f44d496 (diff)
downloadgitlab-ce-c2c7014e017a36e2819335653f5d3fc04cc2c054.tar.gz
Improve documentation and add changelog
Diffstat (limited to 'spec')
-rw-r--r--spec/services/notification_service_spec.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index d557b2e65b8..6a84dcfa014 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -106,6 +106,35 @@ describe NotificationService, services: true do
should_not_email(@u_disabled)
end
end
+
+ context 'when user is not project member' do
+ let(:user) { create(:user) }
+ let(:project) { create(:empty_project, :public) }
+ let(:issue) { create(:issue, project: project, assignee: create(:user)) }
+ let(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: 'anything') }
+
+ before { ActionMailer::Base.deliveries.clear }
+
+ context "and has notification setting" do
+ before do
+ setting = user.notification_settings_for(project)
+ setting.level = :watch
+ setting.save
+ end
+
+ it "sends user email" do
+ notification.new_note(note)
+ should_email(user)
+ end
+ end
+
+ context "and does note have notification setting" do
+ it "does not send email" do
+ notification.new_note(note)
+ should_not_email(user)
+ end
+ end
+ end
end
context 'confidential issue note' do
@@ -147,7 +176,6 @@ describe NotificationService, services: true do
before do
build_team(note.project)
note.project.team << [[note.author, note.noteable.author, note.noteable.assignee], :master]
-
ActionMailer::Base.deliveries.clear
end