Fix Rubocop offenses
This commit is contained in:
parent
13e0ee3735
commit
ffbaf19fe8
4 changed files with 14 additions and 14 deletions
|
@ -15,39 +15,39 @@ module Gitlab
|
|||
{
|
||||
pattern: /\A-\/system\/appearance\/logo\/(\d+)/,
|
||||
uploader: 'AttachmentUploader',
|
||||
model_type: 'Appearance',
|
||||
model_type: 'Appearance'
|
||||
},
|
||||
{
|
||||
pattern: /\A-\/system\/appearance\/header_logo\/(\d+)/,
|
||||
uploader: 'AttachmentUploader',
|
||||
model_type: 'Appearance',
|
||||
model_type: 'Appearance'
|
||||
},
|
||||
{
|
||||
pattern: /\A-\/system\/note\/attachment\/(\d+)/,
|
||||
uploader: 'AttachmentUploader',
|
||||
model_type: 'Note',
|
||||
model_type: 'Note'
|
||||
},
|
||||
{
|
||||
pattern: /\A-\/system\/user\/avatar\/(\d+)/,
|
||||
uploader: 'AvatarUploader',
|
||||
model_type: 'User',
|
||||
model_type: 'User'
|
||||
},
|
||||
{
|
||||
pattern: /\A-\/system\/group\/avatar\/(\d+)/,
|
||||
uploader: 'AvatarUploader',
|
||||
model_type: 'Namespace',
|
||||
model_type: 'Namespace'
|
||||
},
|
||||
{
|
||||
pattern: /\A-\/system\/project\/avatar\/(\d+)/,
|
||||
uploader: 'AvatarUploader',
|
||||
model_type: 'Project',
|
||||
model_type: 'Project'
|
||||
},
|
||||
{
|
||||
pattern: FILE_UPLOADER_PATH_PATTERN,
|
||||
uploader: 'FileUploader',
|
||||
model_type: 'Project'
|
||||
},
|
||||
]
|
||||
}
|
||||
].freeze
|
||||
|
||||
scope :untracked, -> { where(tracked: false) }
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ module Gitlab
|
|||
include Database::MigrationHelpers
|
||||
|
||||
FILE_PATH_BATCH_SIZE = 500
|
||||
UPLOAD_DIR = "#{CarrierWave.root}/uploads"
|
||||
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'
|
||||
UPLOAD_DIR = "#{CarrierWave.root}/uploads".freeze
|
||||
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze
|
||||
|
||||
class UnhashedUploadFile < ActiveRecord::Base
|
||||
include EachBatch
|
||||
|
@ -33,7 +33,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def store_unhashed_upload_file_paths
|
||||
return unless Dir.exists?(UPLOAD_DIR)
|
||||
return unless Dir.exist?(UPLOAD_DIR)
|
||||
|
||||
file_paths = []
|
||||
each_file_path(UPLOAD_DIR) do |file_path|
|
||||
|
|
|
@ -129,7 +129,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UnhashedUploadFi
|
|||
it 'does not add an upload' do
|
||||
expect do
|
||||
unhashed_upload_file.ensure_tracked!
|
||||
end.to_not change { upload_class.count }.from(1)
|
||||
end.not_to change { upload_class.count }.from(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
|
|||
migrate!
|
||||
|
||||
max_length_namespace_path = max_length_project_path = max_length_filename = 'a' * 255
|
||||
long_path = "./uploads#{("/#{max_length_namespace_path}") * Namespace::NUMBER_OF_ANCESTORS_ALLOWED}/#{max_length_project_path}/#{max_length_filename}"
|
||||
long_path = "./uploads#{"/#{max_length_namespace_path}" * Namespace::NUMBER_OF_ANCESTORS_ALLOWED}/#{max_length_project_path}/#{max_length_filename}"
|
||||
unhashed_upload_file = UnhashedUploadFile.new(path: long_path)
|
||||
unhashed_upload_file.save!
|
||||
expect(UnhashedUploadFile.first.path.size).to eq(5641)
|
||||
|
@ -106,7 +106,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
|
|||
|
||||
expect(user1.reload.uploads.first.attributes).to include({
|
||||
"path" => "uploads/-/system/user/avatar/#{user1.id}/rails_sample.jpg",
|
||||
"uploader" => "AvatarUploader",
|
||||
"uploader" => "AvatarUploader"
|
||||
}.merge(rails_sample_jpg_attrs))
|
||||
expect(project1.reload.uploads.first.attributes).to include({
|
||||
"path" => "uploads/-/system/project/avatar/#{project1.id}/rails_sample.jpg",
|
||||
|
|
Loading…
Reference in a new issue