diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/lib/bulk_imports/groups | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/lib/bulk_imports/groups')
-rw-r--r-- | spec/lib/bulk_imports/groups/stage_spec.rb | 24 | ||||
-rw-r--r-- | spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb | 5 |
2 files changed, 26 insertions, 3 deletions
diff --git a/spec/lib/bulk_imports/groups/stage_spec.rb b/spec/lib/bulk_imports/groups/stage_spec.rb index 528d65615b1..cc772f07d21 100644 --- a/spec/lib/bulk_imports/groups/stage_spec.rb +++ b/spec/lib/bulk_imports/groups/stage_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Groups::Stage do +RSpec.describe BulkImports::Groups::Stage, feature_category: :importers do let(:ancestor) { create(:group) } let(:group) { build(:group, parent: ancestor) } let(:bulk_import) { build(:bulk_import) } @@ -77,6 +77,28 @@ RSpec.describe BulkImports::Groups::Stage do ) end + describe 'migrate projects flag' do + context 'when true' do + it 'includes project entities pipeline' do + entity.update!(migrate_projects: true) + + expect(described_class.new(entity).pipelines).to include( + hash_including({ pipeline: BulkImports::Groups::Pipelines::ProjectEntitiesPipeline }) + ) + end + end + + context 'when false' do + it 'does not include project entities pipeline' do + entity.update!(migrate_projects: false) + + expect(described_class.new(entity).pipelines).not_to include( + hash_including({ pipeline: BulkImports::Groups::Pipelines::ProjectEntitiesPipeline }) + ) + end + end + end + context 'when feature flag is enabled on root ancestor level' do it 'includes project entities pipeline' do stub_feature_flags(bulk_import_projects: ancestor) diff --git a/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb b/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb index 6450d90ec0f..69cf80f92c5 100644 --- a/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb +++ b/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb @@ -6,7 +6,7 @@ RSpec.describe BulkImports::Groups::Transformers::SubgroupToEntityTransformer do describe "#transform" do it "transforms subgroups data in entity params" do parent = create(:group) - parent_entity = instance_double(BulkImports::Entity, group: parent, id: 1) + parent_entity = instance_double(BulkImports::Entity, group: parent, id: 1, migrate_projects: false) context = instance_double(BulkImports::Pipeline::Context, entity: parent_entity) subgroup_data = { "path" => "sub-group", @@ -18,7 +18,8 @@ RSpec.describe BulkImports::Groups::Transformers::SubgroupToEntityTransformer do source_full_path: "parent/sub-group", destination_name: "sub-group", destination_namespace: parent.full_path, - parent_id: 1 + parent_id: 1, + migrate_projects: false ) end end |