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:
Peter Zhu
2022-01-05 12:45:08 -05:00
committed by GitHub
parent 692ba188bf
commit c5fd8c42db
75 changed files with 140 additions and 140 deletions

View File

@ -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)

View File

@ -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