bundle exec rspec fix for ruby3.2 (#1709)

Replace File.exists? with File.exist? and
set empty host when nil on finalize_from_uri

Closes #1708
This commit is contained in:
Darragh Bailey 2023-01-19 15:21:27 +00:00 committed by GitHub
commit d4520bedb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View File

@ -1304,8 +1304,8 @@ module VagrantPlugins
end
end
# Extract host values from uri if provided, otherwise nil
@host = uri.host
# Extract host values from uri if provided, otherwise set empty string
@host = uri.host || ""
@port = uri.port
# only override username if there is a value provided
@username = nil if @username == UNSET_VALUE

View File

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

View File

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

View File

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

View File

@ -86,7 +86,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
],
[ # connect explicit to unix socket
{:uri => "qemu+unix:///system"},
{:uri => "qemu+unix:///system", :connect_via_ssh => false, :host => nil, :username => nil},
{:uri => "qemu+unix:///system", :connect_via_ssh => false, :host => "", :username => nil},
],
[ # via libssh2 should enable ssh as well
{:uri => "qemu+libssh2://user@remote/system?known_hosts=/home/user/.ssh/known_hosts"},
@ -139,7 +139,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
],
[ # with session and using ssh infer connect by ssh and ignore host as not provided
{},
{:uri => "qemu+ssh:///session", :qemu_use_session => true, :connect_via_ssh => true, :host => nil},
{:uri => "qemu+ssh:///session", :qemu_use_session => true, :connect_via_ssh => true, :host => ""},
{
:env => {'LIBVIRT_DEFAULT_URI' => "qemu+ssh:///session"},
}