summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-11 17:53:38 +0000
committerRémy Coutable <remy@rymai.me>2016-07-11 17:53:38 +0000
commitf5ceb638963f38fb647b29d7a69af5e38509d7a6 (patch)
treec13ee69c2c49e5c663af41a448b15542a9346f45 /spec
parentef9ba9050e65f9f5572100989745b1b39f764b3b (diff)
parentea40c08d5f313defade9a939e5d5d841aa3ba902 (diff)
downloadgitlab-ce-f5ceb638963f38fb647b29d7a69af5e38509d7a6.tar.gz
Merge branch 'fix-sent-notification-position' into 'master'
Allow SentNotification#position to be set as string or hash Fixes https://sentry.gitlap.com/gitlab/staginggitlabcom/issues/8491/ See merge request !5189
Diffstat (limited to 'spec')
-rw-r--r--spec/services/notification_service_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 54719cbb8d8..d3dddfb4817 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -293,6 +293,30 @@ describe NotificationService, services: true do
end
end
end
+
+ context "merge request diff note" do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:merge_request) { create(:merge_request, source_project: project, assignee: user) }
+ let(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) }
+
+ before do
+ build_team(note.project)
+ project.team << [merge_request.author, :master]
+ project.team << [merge_request.assignee, :master]
+ end
+
+ describe :new_note do
+ it "records sent notifications" do
+ # Ensure create SentNotification by noteable = merge_request 6 times, not noteable = note
+ expect(SentNotification).to receive(:record_note).with(note, any_args).exactly(4).times.and_call_original
+
+ notification.new_note(note)
+
+ expect(SentNotification.last.position).to eq(note.position)
+ end
+ end
+ end
end
describe 'Issues' do