summaryrefslogtreecommitdiff
path: root/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb')
-rw-r--r--spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb26
1 files changed, 15 insertions, 11 deletions
diff --git a/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb b/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
index 75d8c15088a..c42ca9bef3b 100644
--- a/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
+++ b/spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb
@@ -6,7 +6,6 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
describe '#transform' do
let_it_be(:user) { create(:user) }
let_it_be(:parent) { create(:group) }
- let_it_be(:group) { create(:group, name: 'My Source Group', parent: parent) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
let_it_be(:entity) do
@@ -14,7 +13,7 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
:bulk_import_entity,
bulk_import: bulk_import,
source_full_path: 'source/full/path',
- destination_name: group.name,
+ destination_name: 'destination-name-path',
destination_namespace: parent.full_path
)
end
@@ -24,7 +23,8 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
let(:data) do
{
- 'name' => 'source_name',
+ 'name' => 'Source Group Name',
+ 'path' => 'source-group-path',
'full_path' => 'source/full/path',
'visibility' => 'private',
'project_creation_level' => 'developer',
@@ -34,23 +34,27 @@ RSpec.describe BulkImports::Groups::Transformers::GroupAttributesTransformer do
subject { described_class.new }
- it 'transforms name to destination name' do
- transformed_data = subject.transform(context, data)
+ it 'returns original data with some keys transformed' do
+ transformed_data = subject.transform(context, { 'name' => 'Name', 'description' => 'Description' })
- expect(transformed_data['name']).not_to eq('source_name')
- expect(transformed_data['name']).to eq(group.name)
+ expect(transformed_data).to eq({
+ 'name' => 'Name',
+ 'description' => 'Description',
+ 'parent_id' => parent.id,
+ 'path' => 'destination-name-path'
+ })
end
- it 'removes full path' do
+ it 'transforms path from destination_name' do
transformed_data = subject.transform(context, data)
- expect(transformed_data).not_to have_key('full_path')
+ expect(transformed_data['path']).to eq(entity.destination_name)
end
- it 'transforms path to parameterized name' do
+ it 'removes full path' do
transformed_data = subject.transform(context, data)
- expect(transformed_data['path']).to eq(group.name.parameterize)
+ expect(transformed_data).not_to have_key('full_path')
end
it 'transforms visibility level' do