Commit 25b3b2e5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make it possible to resolve all todos for pipeline

parent fc133129
......@@ -18,5 +18,11 @@ module MergeRequests
todo_service.merge_request_build_retried(merge_request)
end
end
def close_all(pipeline)
pipeline_merge_requests(pipeline) do |merge_request|
todo_service.merge_request_build_retried(merge_request)
end
end
end
end
......@@ -17,7 +17,7 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
described_class.new(project, user, commit_message: 'Awesome message')
end
let(:todo_service) { TodoService.new }
let(:todo_service) { spy('todo service') }
let(:merge_request) do
create(:merge_request, merge_user: user,
......@@ -107,4 +107,27 @@ describe MergeRequests::AddTodoWhenBuildFailsService do
end
end
end
describe '#close_all' do
context 'when using pipeline that belongs to merge request' do
it 'resolves todos about failed builds for pipeline' do
service.close_all(pipeline)
expect(todo_service)
.to have_received(:merge_request_build_retried)
.with(merge_request)
end
end
context 'when pipeline is not related to merge request' do
let(:pipeline) { create(:ci_empty_pipeline) }
it 'does not resolve any todos about failed builds' do
service.close_all(pipeline)
expect(todo_service)
.not_to have_received(:merge_request_build_retried)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment