2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Notes::ResolveService do
|
2018-10-15 14:42:47 +05:30
|
|
|
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-03-13 15:44:24 +05:30
|
|
|
expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance|
|
|
|
|
expect(instance).to receive(:execute).with(merge_request)
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
described_class.new(merge_request.project, user).execute(note)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|