Skip to content
Snippets Groups Projects
Commit ffbaf19f authored by Michael Kozono's avatar Michael Kozono
Browse files

Fix Rubocop offenses

parent 13e0ee37
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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) }
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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|
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment