summaryrefslogtreecommitdiff
path: root/spec/services/notes
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-05-01 12:39:44 +0000
committerDouwe Maan <douwe@gitlab.com>2018-05-01 12:39:44 +0000
commit7a76caa5a8d2c6be9aa4b698a8919e223df973d3 (patch)
tree0f9240de123b0570be2a5aec9566d0dcf7a65627 /spec/services/notes
parent3fcb9c115d776feba3f71fb58359a3935edfda9b (diff)
downloadgitlab-ce-7a76caa5a8d2c6be9aa4b698a8919e223df973d3.tar.gz
Merge request and commit discussions API
Diffstat (limited to 'spec/services/notes')
-rw-r--r--spec/services/notes/resolve_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/notes/resolve_service_spec.rb b/spec/services/notes/resolve_service_spec.rb
new file mode 100644
index 00000000000..b54d40a7a5c
--- /dev/null
+++ b/spec/services/notes/resolve_service_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Notes::ResolveService do
+ let(:merge_request) { create(:merge_request) }
+ let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: merge_request.project) }
+ let(:user) { merge_request.author }
+
+ describe '#execute' do
+ it "resolves the note" do
+ described_class.new(merge_request.project, user).execute(note)
+ note.reload
+
+ expect(note.resolved?).to be true
+ expect(note.resolved_by).to eq(user)
+ end
+
+ it "sends notifications if all discussions are resolved" do
+ expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
+
+ described_class.new(merge_request.project, user).execute(note)
+ end
+ end
+end