summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/background_migration/migrate_system_uploads_to_new_folder_spec.rb
blob: 7b5a00c611175726f6b65dcb383d02e28c3c4441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 do
      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