Welcome to mirror list, hosted at ThFree Co, Russian Federation.

migrate_system_uploads_to_new_folder_spec.rb « background_migration « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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