diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-12 12:10:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-12 12:10:19 +0300 |
commit | 133ec9237af290062aae70e6f115db69b51c88de (patch) | |
tree | 866ddeec2098e6557e4fe93941438ada45713940 /spec/models/bulk_imports | |
parent | f9ad7e0c9fa576bf4d651ffe3e278750bf548400 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/bulk_imports')
-rw-r--r-- | spec/models/bulk_imports/export_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/bulk_imports/file_transfer/group_config_spec.rb (renamed from spec/models/bulk_imports/exports/group_config_spec.rb) | 6 | ||||
-rw-r--r-- | spec/models/bulk_imports/file_transfer/project_config_spec.rb (renamed from spec/models/bulk_imports/exports/project_config_spec.rb) | 6 | ||||
-rw-r--r-- | spec/models/bulk_imports/file_transfer_spec.rb | 25 |
4 files changed, 36 insertions, 11 deletions
diff --git a/spec/models/bulk_imports/export_spec.rb b/spec/models/bulk_imports/export_spec.rb index 26d25e6901e..d85b77d599b 100644 --- a/spec/models/bulk_imports/export_spec.rb +++ b/spec/models/bulk_imports/export_spec.rb @@ -47,12 +47,12 @@ RSpec.describe BulkImports::Export, type: :model do end end - describe '#exportable' do + describe '#portable' do context 'when associated with project' do it 'returns project' do export = create(:bulk_import_export, project: create(:project), group: nil) - expect(export.exportable).to be_instance_of(Project) + expect(export.portable).to be_instance_of(Project) end end @@ -60,7 +60,7 @@ RSpec.describe BulkImports::Export, type: :model do it 'returns group' do export = create(:bulk_import_export) - expect(export.exportable).to be_instance_of(Group) + expect(export.portable).to be_instance_of(Group) end end end @@ -70,7 +70,7 @@ RSpec.describe BulkImports::Export, type: :model do it 'returns project config' do export = create(:bulk_import_export, project: create(:project), group: nil) - expect(export.config).to be_instance_of(BulkImports::Exports::ProjectConfig) + expect(export.config).to be_instance_of(BulkImports::FileTransfer::ProjectConfig) end end @@ -78,7 +78,7 @@ RSpec.describe BulkImports::Export, type: :model do it 'returns group config' do export = create(:bulk_import_export) - expect(export.config).to be_instance_of(BulkImports::Exports::GroupConfig) + expect(export.config).to be_instance_of(BulkImports::FileTransfer::GroupConfig) end end end diff --git a/spec/models/bulk_imports/exports/group_config_spec.rb b/spec/models/bulk_imports/file_transfer/group_config_spec.rb index 856977c9310..21da71de3c7 100644 --- a/spec/models/bulk_imports/exports/group_config_spec.rb +++ b/spec/models/bulk_imports/file_transfer/group_config_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Exports::GroupConfig do +RSpec.describe BulkImports::FileTransfer::GroupConfig do let_it_be(:exportable) { create(:group) } let_it_be(:hex) { '123' } @@ -18,7 +18,7 @@ RSpec.describe BulkImports::Exports::GroupConfig do expect(finder).to receive(:find_root).with(:group).and_call_original end - expect(subject.exportable_tree).not_to be_empty + expect(subject.portable_tree).not_to be_empty end end @@ -32,7 +32,7 @@ RSpec.describe BulkImports::Exports::GroupConfig do describe '#exportable_relations' do it 'returns a list of top level exportable relations' do - expect(subject.exportable_relations).to include('milestones', 'badges', 'boards', 'labels') + expect(subject.portable_relations).to include('milestones', 'badges', 'boards', 'labels') end end end diff --git a/spec/models/bulk_imports/exports/project_config_spec.rb b/spec/models/bulk_imports/file_transfer/project_config_spec.rb index c0b685a091d..021f96ac2a3 100644 --- a/spec/models/bulk_imports/exports/project_config_spec.rb +++ b/spec/models/bulk_imports/file_transfer/project_config_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Exports::ProjectConfig do +RSpec.describe BulkImports::FileTransfer::ProjectConfig do let_it_be(:exportable) { create(:project) } let_it_be(:hex) { '123' } @@ -18,7 +18,7 @@ RSpec.describe BulkImports::Exports::ProjectConfig do expect(finder).to receive(:find_root).with(:project).and_call_original end - expect(subject.exportable_tree).not_to be_empty + expect(subject.portable_tree).not_to be_empty end end @@ -32,7 +32,7 @@ RSpec.describe BulkImports::Exports::ProjectConfig do describe '#exportable_relations' do it 'returns a list of top level exportable relations' do - expect(subject.exportable_relations).to include('issues', 'labels', 'milestones', 'merge_requests') + expect(subject.portable_relations).to include('issues', 'labels', 'milestones', 'merge_requests') end end end diff --git a/spec/models/bulk_imports/file_transfer_spec.rb b/spec/models/bulk_imports/file_transfer_spec.rb new file mode 100644 index 00000000000..5a2b303626c --- /dev/null +++ b/spec/models/bulk_imports/file_transfer_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe BulkImports::FileTransfer do + describe '.config_for' do + context 'when portable is group' do + it 'returns group config' do + expect(described_class.config_for(build(:group))).to be_instance_of(BulkImports::FileTransfer::GroupConfig) + end + end + + context 'when portable is project' do + it 'returns project config' do + expect(described_class.config_for(build(:project))).to be_instance_of(BulkImports::FileTransfer::ProjectConfig) + end + end + + context 'when portable is unsupported' do + it 'raises an error' do + expect { described_class.config_for(nil) }.to raise_error(BulkImports::FileTransfer::UnsupportedObjectType) + end + end + end +end |