blob: 3e6f2ea3f5df9f426180499714e22763dbb027d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequests::ResolveTodosService do
let_it_be(:merge_request) { create(:merge_request) }
let_it_be(:user) { create(:user) }
let(:service) { described_class.new(merge_request, user) }
describe '#async_execute' do
def async_execute
service.async_execute
end
it 'performs MergeRequests::ResolveTodosWorker asynchronously' do
expect(MergeRequests::ResolveTodosWorker)
.to receive(:perform_async)
.with(
merge_request.id,
user.id
)
async_execute
end
context 'when resolve_merge_request_todos_async feature is disabled' do
before do
stub_feature_flags(resolve_merge_request_todos_async: false)
end
it 'calls #execute' do
expect(service).to receive(:execute)
async_execute
end
end
end
describe '#execute' do
it 'marks pending todo as done' do
pending_todo = create(:todo, :pending, user: user, project: merge_request.project, target: merge_request)
service.execute
expect(pending_todo.reload).to be_done
end
end
end
|