debian-mirror-gitlab/spec/services/notes/resolve_service_spec.rb

28 lines
887 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require 'spec_helper'
2023-05-27 22:25:52 +05:30
RSpec.describe Notes::ResolveService, feature_category: :team_planning 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