diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/models/bulk_imports/file_transfer/project_config_spec.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/models/bulk_imports/file_transfer/project_config_spec.rb')
-rw-r--r-- | spec/models/bulk_imports/file_transfer/project_config_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/bulk_imports/file_transfer/project_config_spec.rb b/spec/models/bulk_imports/file_transfer/project_config_spec.rb new file mode 100644 index 00000000000..021f96ac2a3 --- /dev/null +++ b/spec/models/bulk_imports/file_transfer/project_config_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe BulkImports::FileTransfer::ProjectConfig do + let_it_be(:exportable) { create(:project) } + let_it_be(:hex) { '123' } + + before do + allow(SecureRandom).to receive(:hex).and_return(hex) + end + + subject { described_class.new(exportable) } + + describe '#exportable_tree' do + it 'returns exportable tree' do + expect_next_instance_of(::Gitlab::ImportExport::AttributesFinder) do |finder| + expect(finder).to receive(:find_root).with(:project).and_call_original + end + + expect(subject.portable_tree).not_to be_empty + end + end + + describe '#export_path' do + it 'returns correct export path' do + expect(::Gitlab::ImportExport).to receive(:storage_path).and_return('storage_path') + + expect(subject.export_path).to eq("storage_path/#{exportable.disk_path}/#{hex}") + end + end + + describe '#exportable_relations' do + it 'returns a list of top level exportable relations' do + expect(subject.portable_relations).to include('issues', 'labels', 'milestones', 'merge_requests') + end + end +end |