diff options
Diffstat (limited to 'spec/services/merge_requests/squash_service_spec.rb')
-rw-r--r-- | spec/services/merge_requests/squash_service_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/merge_requests/squash_service_spec.rb b/spec/services/merge_requests/squash_service_spec.rb index cb278eec692..4636f26bb16 100644 --- a/spec/services/merge_requests/squash_service_spec.rb +++ b/spec/services/merge_requests/squash_service_spec.rb @@ -137,6 +137,24 @@ describe MergeRequests::SquashService do include_examples 'the squash succeeds' end + context 'when the merge request has already been merged' do + let(:merge_request) { merge_request_with_one_commit } + + it 'checks the side-effects for multiple calls' do + merge_request.mark_as_merged + + expect(service).to be_idempotent + expect { IdempotentWorkerHelper::WORKER_EXEC_TIMES.times { service.execute } }.not_to raise_error + end + + it 'idempotently returns a success' do + merge_request.mark_as_merged + result = service.execute + + expect(result).to match(status: :success, squash_sha: merge_request.diff_head_sha) + end + end + context 'git errors' do let(:merge_request) { merge_request_with_only_new_files } let(:error) { 'A test error' } |