Merge branch 'osw-mark-as-merged-as-first-post-merge-action' into 'master'
Mark MR as merged regardless of errors when closing issues See merge request gitlab-org/gitlab-ce!20218
This commit is contained in:
commit
a17d0527be
3 changed files with 19 additions and 1 deletions
|
@ -6,9 +6,9 @@ module MergeRequests
|
|||
#
|
||||
class PostMergeService < MergeRequests::BaseService
|
||||
def execute(merge_request)
|
||||
merge_request.mark_as_merged
|
||||
close_issues(merge_request)
|
||||
todo_service.merge_merge_request(merge_request, current_user)
|
||||
merge_request.mark_as_merged
|
||||
create_event(merge_request)
|
||||
create_note(merge_request)
|
||||
notification_service.merge_mr(merge_request, current_user)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Mark MR as merged regardless of errors when closing issues
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -47,5 +47,18 @@ describe MergeRequests::PostMergeService do
|
|||
|
||||
expect(diff_removal_service).to have_received(:execute)
|
||||
end
|
||||
|
||||
it 'marks MR as merged regardless of errors when closing issues' do
|
||||
merge_request.update(target_branch: 'foo')
|
||||
allow(project).to receive(:default_branch).and_return('foo')
|
||||
|
||||
issue = create(:issue, project: project)
|
||||
allow(merge_request).to receive(:closes_issues).and_return([issue])
|
||||
allow_any_instance_of(Issues::CloseService).to receive(:execute).with(issue, commit: merge_request).and_raise
|
||||
|
||||
expect { described_class.new(project, user, {}).execute(merge_request) }.to raise_error
|
||||
|
||||
expect(merge_request.reload).to be_merged
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue