From 0b05302cfe3334c3b3ab3e40630af2f3a3b655bd Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Tue, 9 Feb 2021 16:20:11 +0100 Subject: [PATCH] FIX: Restoring could fail due to missing path --- lib/backup_restore/backup_file_handler.rb | 2 +- lib/backup_restore/factory.rb | 2 +- spec/lib/backup_restore/backup_file_handler_spec.rb | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/backup_restore/backup_file_handler.rb b/lib/backup_restore/backup_file_handler.rb index 5b4fd82cd5c..d9369789fb8 100644 --- a/lib/backup_restore/backup_file_handler.rb +++ b/lib/backup_restore/backup_file_handler.rb @@ -6,7 +6,7 @@ module BackupRestore delegate :log, to: :@logger, private: true - def initialize(logger, filename, current_db, root_tmp_directory = Rails.root, location = nil) + def initialize(logger, filename, current_db, root_tmp_directory: Rails.root, location: nil) @logger = logger @filename = filename @current_db = current_db diff --git a/lib/backup_restore/factory.rb b/lib/backup_restore/factory.rb index 1e7d35f0be7..869b05a09a5 100644 --- a/lib/backup_restore/factory.rb +++ b/lib/backup_restore/factory.rb @@ -28,7 +28,7 @@ module BackupRestore end def create_backup_file_handler(filename, current_db, location) - BackupFileHandler.new(logger, filename, current_db, location) + BackupFileHandler.new(logger, filename, current_db, location: location) end end end diff --git a/spec/lib/backup_restore/backup_file_handler_spec.rb b/spec/lib/backup_restore/backup_file_handler_spec.rb index 46bd36815d7..80a0e62b805 100644 --- a/spec/lib/backup_restore/backup_file_handler_spec.rb +++ b/spec/lib/backup_restore/backup_file_handler_spec.rb @@ -19,7 +19,11 @@ describe BackupRestore::BackupFileHandler do Dir.mktmpdir do |root_directory| current_db = RailsMultisite::ConnectionManagement.current_db - file_handler = BackupRestore::BackupFileHandler.new(logger, backup_filename, current_db, root_directory, location) + file_handler = BackupRestore::BackupFileHandler.new( + logger, backup_filename, current_db, + root_tmp_directory: root_directory, + location: location + ) tmp_directory, db_dump_path = file_handler.decompress expected_tmp_path = File.join(root_directory, "tmp/restores", current_db, "2019-12-24-143148")