Commit 8cabf62b authored by Mark Chao's avatar Mark Chao

Finalize approval state when merged

parent c89c4d82
...@@ -52,3 +52,5 @@ module MergeRequests ...@@ -52,3 +52,5 @@ module MergeRequests
end end
end end
end end
MergeRequests::PostMergeService.prepend(EE::MergeRequests::PostMergeService)
# frozen_string_literal: true
module EE
module MergeRequests
module PostMergeService
extend ::Gitlab::Utils::Override
override :execute
def execute(merge_request)
super
ApprovalRules::FinalizeService.new(merge_request).execute
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe MergeRequests::PostMergeService do
let(:project) { merge_request.target_project }
let(:merge_request) { create(:merge_request) }
let(:current_user) { merge_request.author }
let(:service) { described_class.new(project, current_user) }
describe '#execute' do
context 'finalize approvals' do
let(:finalize_service) { double(:finalize_service) }
it 'executes ApprovalRules::FinalizeService' do
expect(ApprovalRules::FinalizeService).to receive(:new).and_return(finalize_service)
expect(finalize_service).to receive(:execute)
service.execute(merge_request)
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