diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/services/merge_requests/mergeability_check_service_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/services/merge_requests/mergeability_check_service_spec.rb')
-rw-r--r-- | spec/services/merge_requests/mergeability_check_service_spec.rb | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/spec/services/merge_requests/mergeability_check_service_spec.rb b/spec/services/merge_requests/mergeability_check_service_spec.rb index 543da46f883..725fc16fa7c 100644 --- a/spec/services/merge_requests/mergeability_check_service_spec.rb +++ b/spec/services/merge_requests/mergeability_check_service_spec.rb @@ -41,16 +41,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar subject end - context 'when merge_ref_head_comments is disabled' do - it 'does not update diff discussion positions' do - stub_feature_flags(merge_ref_head_comments: false) - - expect(Discussions::CaptureDiffNotePositionsService).not_to receive(:new) - - subject - end - end - it 'updates the merge ref' do expect { subject }.to change(merge_request, :merge_ref_head).from(nil) end @@ -221,11 +211,18 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar target_branch: 'conflict-start') end - it_behaves_like 'unmergeable merge request' + it 'does not change the merge ref HEAD' do + expect(merge_request.merge_ref_head).to be_nil - it 'returns ServiceResponse.error' do + subject + + expect(merge_request.reload.merge_ref_head).not_to be_nil + end + + it 'returns ServiceResponse.error and keeps merge status as cannot_be_merged' do result = subject + expect(merge_request.merge_status).to eq('cannot_be_merged') expect(result).to be_a(ServiceResponse) expect(result.error?).to be(true) expect(result.message).to eq('Merge request is not mergeable') @@ -383,5 +380,27 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar end end end + + context 'merge with conflicts' do + it 'calls MergeToRefService with true allow_conflicts param' do + expect(MergeRequests::MergeToRefService).to receive(:new) + .with(project, merge_request.author, { allow_conflicts: true }).and_call_original + + subject + end + + context 'when display_merge_conflicts_in_diff is disabled' do + before do + stub_feature_flags(display_merge_conflicts_in_diff: false) + end + + it 'calls MergeToRefService with false allow_conflicts param' do + expect(MergeRequests::MergeToRefService).to receive(:new) + .with(project, merge_request.author, { allow_conflicts: false }).and_call_original + + subject + end + end + end end end |