2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-01 08:39:44 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe Notes::ResolveService do
|
2018-05-01 08:39:44 -04:00
|
|
|
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
|
2020-01-17 16:08:29 -05:00
|
|
|
expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance|
|
|
|
|
expect(instance).to receive(:execute).with(merge_request)
|
|
|
|
end
|
2018-05-01 08:39:44 -04:00
|
|
|
|
|
|
|
described_class.new(merge_request.project, user).execute(note)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|