Commit 15717060 authored by James Lopez's avatar James Lopez

fix custom template export import strategy spec

parent e12b81ad
...@@ -23,14 +23,13 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm ...@@ -23,14 +23,13 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm
describe '#execute' do describe '#execute' do
it 'updates the project import_source with the path to import' do it 'updates the project import_source with the path to import' do
path = Tempfile.new.path file = fixture_file_upload('spec/fixtures/project_export.tar.gz')
allow(subject).to receive(:import_upload_path).and_return(path) allow(subject).to receive(:export_file).and_return(file)
expect(Project).to receive(:update).with(project.id, import_source: path).and_call_original
subject.execute(user, project_template) subject.execute(user, project_template)
expect(project.reload.import_source).to eq path expect(project.reload.import_export_upload.import_file.file).not_to be_nil
end end
it 'imports repository' do it 'imports repository' do
...@@ -48,21 +47,12 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm ...@@ -48,21 +47,12 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm
end end
describe 'export_file' do describe 'export_file' do
let(:project_template) { create(:project, :with_export) }
before do before do
allow(subject).to receive(:project).and_return(project_template) allow(subject).to receive(:project).and_return(project_template)
end end
context 'without object storage' do
it 'returns the local path' do
subject.execute(user, project_template)
expect(subject.send(:export_file)).not_to be_nil
end
end
context 'with object storage' do
let(:project_template) { create(:project, :with_object_export) }
it 'returns the path from object storage' do it 'returns the path from object storage' do
subject.execute(user, project_template) subject.execute(user, project_template)
...@@ -70,5 +60,4 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm ...@@ -70,5 +60,4 @@ describe EE::Gitlab::ImportExport::AfterExportStrategies::CustomTemplateExportIm
end end
end end
end end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment