diff options
author | Sean McGivern <sean@gitlab.com> | 2018-07-10 15:00:13 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-07-10 15:06:20 +0100 |
commit | 57fc7cd8f35525f772d7c59a2aa45c96467cb882 (patch) | |
tree | 12123ad5d95b5bd5b3335996cbe398f27d9780c1 /spec | |
parent | 3d4873fa64c833c71ab7ee274002d854eb93ef96 (diff) | |
download | gitlab-ce-57fc7cd8f35525f772d7c59a2aa45c96467cb882.tar.gz |
Make sure ConflictsService does not raise for conflicting submodules
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 22 | ||||
-rw-r--r-- | spec/services/merge_requests/conflicts/list_service_spec.rb | 10 | ||||
-rw-r--r-- | spec/support/helpers/test_env.rb | 4 |
3 files changed, 25 insertions, 11 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index d060ab923d1..caf5d829d21 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -431,6 +431,18 @@ describe Repository do it { is_expected.to be_falsey } end + + context 'non merged branch' do + subject { repository.merged_to_root_ref?('fix') } + + it { is_expected.to be_falsey } + end + + context 'non existent branch' do + subject { repository.merged_to_root_ref?('non_existent_branch') } + + it { is_expected.to be_nil } + end end describe '#can_be_merged?' do @@ -452,17 +464,11 @@ describe Repository do it { is_expected.to be_falsey } end - context 'non merged branch' do - subject { repository.merged_to_root_ref?('fix') } + context 'submodule changes that confuse rugged' do + subject { repository.can_be_merged?('update-gitlab-shell-v-6-0-1', 'update-gitlab-shell-v-6-0-3') } it { is_expected.to be_falsey } end - - context 'non existent branch' do - subject { repository.merged_to_root_ref?('non_existent_branch') } - - it { is_expected.to be_nil } - end end describe '#commit' do diff --git a/spec/services/merge_requests/conflicts/list_service_spec.rb b/spec/services/merge_requests/conflicts/list_service_spec.rb index a5520e7373e..c81fa95e4b7 100644 --- a/spec/services/merge_requests/conflicts/list_service_spec.rb +++ b/spec/services/merge_requests/conflicts/list_service_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe MergeRequests::Conflicts::ListService do describe '#can_be_resolved_in_ui?' do - def create_merge_request(source_branch) - create(:merge_request, source_branch: source_branch, target_branch: 'conflict-start', merge_status: :unchecked) do |mr| + def create_merge_request(source_branch, target_branch = 'conflict-start') + create(:merge_request, source_branch: source_branch, target_branch: target_branch, merge_status: :unchecked) do |mr| mr.mark_as_unmergeable end end @@ -84,5 +84,11 @@ describe MergeRequests::Conflicts::ListService do expect(service.can_be_resolved_in_ui?).to be_falsey end + + it 'returns a falsey value when the conflict is in a submodule revision' do + merge_request = create_merge_request('update-gitlab-shell-v-6-0-3', 'update-gitlab-shell-v-6-0-1') + + expect(conflicts_service(merge_request).can_be_resolved_in_ui?).to be_falsey + end end end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 05a8e6206ae..e531495d917 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -49,7 +49,9 @@ module TestEnv 'add-pdf-file' => 'e774ebd', 'squash-large-files' => '54cec52', 'add-pdf-text-binary' => '79faa7b', - 'add_images_and_changes' => '010d106' + 'add_images_and_changes' => '010d106', + 'update-gitlab-shell-v-6-0-1' => '2f61d70', + 'update-gitlab-shell-v-6-0-3' => 'de78448' }.freeze # gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily |