From 517bf7792a4f2d9f7d6062efeec9089e78c5458e Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Thu, 19 Jan 2023 16:39:17 +0900 Subject: [PATCH] Replace File.exists? with File.exist? File.exists? is deprecated since ruby2.1 and is removed with ruby3.2. Replace with File.exist? . --- spec/support/libvirt_acceptance_context.rb | 2 +- spec/support/matchers/have_file_content.rb | 2 +- spec/unit/action/clean_machine_folder_spec.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/support/libvirt_acceptance_context.rb b/spec/support/libvirt_acceptance_context.rb index 7628224..8e0f533 100644 --- a/spec/support/libvirt_acceptance_context.rb +++ b/spec/support/libvirt_acceptance_context.rb @@ -71,7 +71,7 @@ shared_context 'libvirt_acceptance' do # allows for a helper Vagrantfile to force specific provider options if testing # environment needs them vagrantfile = File.join(vagrant_home, 'Vagrantfile') - if File.exists?(vagrantfile) and !File.exists?(File.join(target_env.homedir, 'Vagrantfile')) + if File.exist?(vagrantfile) and !File.exist?(File.join(target_env.homedir, 'Vagrantfile')) FileUtils.cp(vagrantfile, target_env.homedir) end end diff --git a/spec/support/matchers/have_file_content.rb b/spec/support/matchers/have_file_content.rb index 9970f6b..2021518 100644 --- a/spec/support/matchers/have_file_content.rb +++ b/spec/support/matchers/have_file_content.rb @@ -45,7 +45,7 @@ require "rspec/expectations/version" # end RSpec::Matchers.define :have_file_content do |expected| match do |actual| - next false unless File.exists?(actual) + next false unless File.exist?(actual) @actual = File.read(actual).chomp @expected = if expected.is_a? String diff --git a/spec/unit/action/clean_machine_folder_spec.rb b/spec/unit/action/clean_machine_folder_spec.rb index faad98c..b8ed8ac 100644 --- a/spec/unit/action/clean_machine_folder_spec.rb +++ b/spec/unit/action/clean_machine_folder_spec.rb @@ -20,7 +20,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CleanMachineFolder do expect(subject.call(env)).to be_nil - expect(File.exists?(machine.data_dir)).to eq(true) + expect(File.exist?(machine.data_dir)).to eq(true) expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) end end @@ -38,7 +38,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CleanMachineFolder do expect(subject.call(env)).to be_nil - expect(File.exists?(machine.data_dir)).to eq(true) + expect(File.exist?(machine.data_dir)).to eq(true) expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) end end @@ -51,7 +51,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CleanMachineFolder do expect(subject.call(env)).to be_nil - expect(File.exists?(machine.data_dir)).to eq(true) + expect(File.exist?(machine.data_dir)).to eq(true) expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) end end