2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe Gitlab::BackgroundMigration::MigrateSystemUploadsToNewFolder, :delete do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:migration) { described_class.new }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(migration).to receive(:logger).and_return(Logger.new(nil))
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#perform' do
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'renames the path of system-uploads' do
|
2017-09-10 17:25:29 +05:30
|
|
|
upload = create(:upload, model: create(:project), path: 'uploads/system/project/avatar.jpg')
|
|
|
|
|
|
|
|
migration.perform('uploads/system/', 'uploads/-/system/')
|
|
|
|
|
|
|
|
expect(upload.reload.path).to eq('uploads/-/system/project/avatar.jpg')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|