diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/models/bulk_imports/entity_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/models/bulk_imports/entity_spec.rb')
-rw-r--r-- | spec/models/bulk_imports/entity_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/bulk_imports/entity_spec.rb b/spec/models/bulk_imports/entity_spec.rb index 0732b671729..e5ab96ca514 100644 --- a/spec/models/bulk_imports/entity_spec.rb +++ b/spec/models/bulk_imports/entity_spec.rb @@ -81,6 +81,37 @@ RSpec.describe BulkImports::Entity, type: :model do expect(entity.errors).to include(:parent) end end + + context 'validate destination namespace of a group_entity' do + it 'is invalid if destination namespace is the source namespace' do + group_a = create(:group, path: 'group_a') + + entity = build( + :bulk_import_entity, + :group_entity, + source_full_path: group_a.full_path, + destination_namespace: group_a.full_path + ) + + expect(entity).not_to be_valid + expect(entity.errors).to include(:destination_namespace) + end + + it 'is invalid if destination namespace is a descendant of the source' do + group_a = create(:group, path: 'group_a') + group_b = create(:group, parent: group_a, path: 'group_b') + + entity = build( + :bulk_import_entity, + :group_entity, + source_full_path: group_a.full_path, + destination_namespace: group_b.full_path + ) + + expect(entity).not_to be_valid + expect(entity.errors).to include(:destination_namespace) + end + end end describe "#update_tracker_for" do |