diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 06:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 06:08:59 +0300 |
commit | 67e7b5a9ba9f88d4495841cb0457a2dbe3afec55 (patch) | |
tree | fe76411a6f84f7f04f30594c9f105385b541b50f /spec/models | |
parent | 5ca56fbe46ffaf7eaeff8d2f39f79f2a576b8e19 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/bulk_imports/entity_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/bulk_imports/entity_spec.rb b/spec/models/bulk_imports/entity_spec.rb index 874009d552a..47d355de1d8 100644 --- a/spec/models/bulk_imports/entity_spec.rb +++ b/spec/models/bulk_imports/entity_spec.rb @@ -46,6 +46,8 @@ RSpec.describe BulkImports::Entity, type: :model do end it 'is invalid as a project_entity' do + stub_feature_flags(bulk_import_projects: true) + entity = build(:bulk_import_entity, :project_entity, group: build(:group), project: nil) expect(entity).not_to be_valid @@ -55,6 +57,8 @@ RSpec.describe BulkImports::Entity, type: :model do context 'when associated with a project and no group' do it 'is valid' do + stub_feature_flags(bulk_import_projects: true) + entity = build(:bulk_import_entity, :project_entity, group: nil, project: build(:project)) expect(entity).to be_valid @@ -84,6 +88,8 @@ RSpec.describe BulkImports::Entity, type: :model do context 'when the parent is a project import' do it 'is invalid' do + stub_feature_flags(bulk_import_projects: true) + entity = build(:bulk_import_entity, parent: build(:bulk_import_entity, :project_entity)) expect(entity).not_to be_valid @@ -124,6 +130,27 @@ RSpec.describe BulkImports::Entity, type: :model do .to include('Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again.') end end + + context 'when bulk_import_projects feature flag is disabled and source_type is a project_entity' do + it 'is invalid' do + stub_feature_flags(bulk_import_projects: false) + + entity = build(:bulk_import_entity, :project_entity) + + expect(entity).not_to be_valid + expect(entity.errors[:base]).to include('invalid entity source type') + end + end + + context 'when bulk_import_projects feature flag is enabled and source_type is a project_entity' do + it 'is valid' do + stub_feature_flags(bulk_import_projects: true) + + entity = build(:bulk_import_entity, :project_entity) + + expect(entity).to be_valid + end + end end describe '#encoded_source_full_path' do |