mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:22:40 +08:00
DEV: Fix methods removed in Ruby 3.2 (#15459)
* File.exists? is deprecated and removed in Ruby 3.2 in favor of File.exist? * Dir.exists? is deprecated and removed in Ruby 3.2 in favor of Dir.exist?
This commit is contained in:
@ -36,16 +36,16 @@ describe BackupRestore::LocalBackupStore do
|
||||
end
|
||||
|
||||
def remove_backups
|
||||
@paths.each { |path| File.delete(path) if File.exists?(path) }
|
||||
@paths.each { |path| File.delete(path) if File.exist?(path) }
|
||||
@paths.clear
|
||||
end
|
||||
|
||||
def create_file(db_name:, filename:, last_modified:, size_in_bytes:)
|
||||
path = File.join(@root_directory, db_name)
|
||||
Dir.mkdir(path) unless Dir.exists?(path)
|
||||
Dir.mkdir(path) unless Dir.exist?(path)
|
||||
|
||||
path = File.join(path, filename)
|
||||
return if File.exists?(path)
|
||||
return if File.exist?(path)
|
||||
|
||||
@paths << path
|
||||
FileUtils.touch(path)
|
||||
|
@ -174,7 +174,7 @@ shared_examples "backup store" do
|
||||
destination_path = File.join(path, File.basename(filename))
|
||||
store.download_file(filename, destination_path)
|
||||
|
||||
expect(File.exists?(destination_path)).to eq(true)
|
||||
expect(File.exist?(destination_path)).to eq(true)
|
||||
expect(File.size(destination_path)).to eq(backup1.size)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user