Commit a67d92d1 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents fa1f244c ef2c1a6b
......@@ -7,10 +7,6 @@ class ImportExportUploader < AttachmentUploader
EXTENSION_WHITELIST
end
def move_to_store
true
end
def move_to_cache
false
end
......
---
title: Clean up CarrierWave's import/export files
merge_request: 27487
author:
type: fixed
......@@ -3,9 +3,18 @@ require 'spec_helper'
describe ImportExportUploader do
let(:model) { build_stubbed(:import_export_upload) }
let(:upload) { create(:upload, model: model) }
let(:import_export_upload) { ImportExportUpload.new }
subject { described_class.new(model, :import_file) }
context 'local store' do
describe '#move_to_store' do
it 'returns true' do
expect(subject.move_to_store).to be true
end
end
end
context "object_store is REMOTE" do
before do
stub_uploads_object_storage
......@@ -16,5 +25,28 @@ describe ImportExportUploader do
it_behaves_like 'builds correct paths',
store_dir: %r[import_export_upload/import_file/],
upload_path: %r[import_export_upload/import_file/]
describe '#move_to_store' do
it 'returns false' do
expect(subject.move_to_store).to be false
end
end
describe 'with an export file directly uploaded' do
let(:tempfile) { Tempfile.new(['test', '.gz']) }
before do
stub_uploads_object_storage(described_class, direct_upload: true)
import_export_upload.export_file = tempfile
end
it 'cleans up cached file' do
cache_dir = File.join(import_export_upload.export_file.cache_path(nil), '*')
import_export_upload.save!
expect(Dir[cache_dir]).to be_empty
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