diff options
author | Stan Hu <stanhu@gmail.com> | 2019-05-14 14:37:15 -0500 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-15 21:34:59 -0700 |
commit | 5632079c3684562aea890123182bd43648149b55 (patch) | |
tree | 327406be44c1893447da6d486ac816a11b80b23a /spec | |
parent | 3d2edaac04ec1e4d5074a43249c11cf6e8a8eecf (diff) | |
download | gitlab-ce-5632079c3684562aea890123182bd43648149b55.tar.gz |
Properly clear the merge error upon rebase failuresh-fix-rebase-error-clearing
If `merge_error` is ever set after a failure, it is never cleared, even
after a subsequent, successful rebase. We now clear this field whenever
a successful rebase occurs.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56139
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/merge_requests/rebase_service_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/services/merge_requests/rebase_service_spec.rb b/spec/services/merge_requests/rebase_service_spec.rb index a443e4588d9..0c4433453ac 100644 --- a/spec/services/merge_requests/rebase_service_spec.rb +++ b/spec/services/merge_requests/rebase_service_spec.rb @@ -38,6 +38,32 @@ describe MergeRequests::RebaseService do end end + shared_examples 'sequence of failure and success' do + it 'properly clears the error message' do + allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong') + + service.execute(merge_request) + + expect(merge_request.reload.merge_error).to eq described_class::REBASE_ERROR + + allow(repository).to receive(:gitaly_operation_client).and_call_original + + service.execute(merge_request) + + expect(merge_request.reload.merge_error).to eq nil + end + end + + it_behaves_like 'sequence of failure and success' + + context 'with deprecated step rebase feature' do + before do + allow(Feature).to receive(:disabled?).with(:two_step_rebase, anything).and_return(true) + end + + it_behaves_like 'sequence of failure and success' + end + context 'when unexpected error occurs' do before do allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong') |