diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/models/bulk_imports/entity_spec.rb | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/models/bulk_imports/entity_spec.rb')
-rw-r--r-- | spec/models/bulk_imports/entity_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/models/bulk_imports/entity_spec.rb b/spec/models/bulk_imports/entity_spec.rb index cc66572cd6f..e5bbac62dcc 100644 --- a/spec/models/bulk_imports/entity_spec.rb +++ b/spec/models/bulk_imports/entity_spec.rb @@ -252,4 +252,60 @@ RSpec.describe BulkImports::Entity, type: :model do .to eq("/groups/#{entity.encoded_source_full_path}/export_relations/download?relation=test") end end + + describe '#entity_type' do + it 'returns entity type' do + group_entity = build(:bulk_import_entity) + project_entity = build(:bulk_import_entity, :project_entity) + + expect(group_entity.entity_type).to eq('group') + expect(project_entity.entity_type).to eq('project') + end + end + + describe '#project?' do + it 'returns true if project entity' do + group_entity = build(:bulk_import_entity) + project_entity = build(:bulk_import_entity, :project_entity) + + expect(group_entity.project?).to eq(false) + expect(project_entity.project?).to eq(true) + end + end + + describe '#group?' do + it 'returns true if group entity' do + group_entity = build(:bulk_import_entity) + project_entity = build(:bulk_import_entity, :project_entity) + + expect(group_entity.group?).to eq(true) + expect(project_entity.group?).to eq(false) + end + end + + describe '#base_resource_url_path' do + it 'returns base entity url path' do + entity = build(:bulk_import_entity) + + expect(entity.base_resource_url_path).to eq("/groups/#{entity.encoded_source_full_path}") + end + end + + describe '#wiki_url_path' do + it 'returns entity wiki url path' do + entity = build(:bulk_import_entity) + + expect(entity.wikis_url_path).to eq("/groups/#{entity.encoded_source_full_path}/wikis") + end + end + + describe '#update_service' do + it 'returns correct update service class' do + group_entity = build(:bulk_import_entity) + project_entity = build(:bulk_import_entity, :project_entity) + + expect(group_entity.update_service).to eq(::Groups::UpdateService) + expect(project_entity.update_service).to eq(::Projects::UpdateService) + end + end end |