diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-07-17 15:23:59 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-07-18 15:38:54 +0200 |
commit | c156030ef965bed019def3993ee21d214fe2f2ba (patch) | |
tree | 2923a0a90a73ce6509f40397874f7a4483e0393e /spec/lib/gitlab | |
parent | 79f591df4dfd6577c55d3bb843e423bba859e9b9 (diff) | |
download | gitlab-ce-c156030ef965bed019def3993ee21d214fe2f2ba.tar.gz |
Add a background migration to rename `uploads` in the uploads table
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb b/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb new file mode 100644 index 00000000000..a910fb105a5 --- /dev/null +++ b/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe Gitlab::BackgroundMigration::MigrateSystemUploadsToNewFolder do + let(:migration) { described_class.new } + + before do + allow(migration).to receive(:logger).and_return(Logger.new(nil)) + end + + describe '#perform' do + it 'renames the path of system-uploads', truncate: true do + upload = create(:upload, model: create(:empty_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 |