Commit ad29681c authored by Dominic Renner's avatar Dominic Renner Committed by Dmitriy Zaporozhets

Replaced config access

Replaced Settings with Gitlab.config for uniformity
parent 2ff13241
...@@ -9,7 +9,7 @@ module Backup ...@@ -9,7 +9,7 @@ module Backup
def initialize(progress) def initialize(progress)
@progress = progress @progress = progress
super('uploads', Rails.root.join('public/uploads')) super('uploads', File.join(Gitlab.config.uploads.storage_path, "uploads"))
end end
end end
end end
require 'spec_helper'
describe Backup::Uploads do
let(:progress) { StringIO.new }
subject(:backup) { described_class.new(progress) }
describe '#initialize' do
it 'uses the correct upload dir' do
Dir.mktmpdir do |tmpdir|
FileUtils.mkdir_p("#{tmpdir}/uploads")
allow(Gitlab.config.uploads).to receive(:storage_path) { tmpdir }
expect(backup.app_files_dir).to eq("#{tmpdir}/uploads")
end
end
end
end
...@@ -21,9 +21,6 @@ describe 'gitlab:app namespace rake task' do ...@@ -21,9 +21,6 @@ describe 'gitlab:app namespace rake task' do
# empty task as env is already loaded # empty task as env is already loaded
Rake::Task.define_task :environment Rake::Task.define_task :environment
# We need this directory to run `gitlab:backup:create` task
FileUtils.mkdir_p('public/uploads')
end end
before do before do
...@@ -38,6 +35,7 @@ describe 'gitlab:app namespace rake task' do ...@@ -38,6 +35,7 @@ describe 'gitlab:app namespace rake task' do
end end
def run_rake_task(task_name) def run_rake_task(task_name)
FileUtils.mkdir_p('tmp/tests/public/uploads')
Rake::Task[task_name].reenable Rake::Task[task_name].reenable
Rake.application.invoke_task task_name Rake.application.invoke_task task_name
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment