Merge pull request #299 from hashicorp/fix-ruby-tests

Fix ruby tests
This commit is contained in:
Sophia Castellarin 2022-06-29 17:23:23 -05:00 committed by GitHub
commit a08204d4ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 4 deletions

View File

@ -564,6 +564,14 @@ class Hashicorp::Vagrant::Sdk::Args::Target::Machine
end
end
class Hashicorp::Vagrant::Sdk::Args::Target::Machine::State
def to_ruby
Vagrant::MachineState.new(
m.id.to_sym, m.short_description, m.long_description
)
end
end
class Hashicorp::Vagrant::Sdk::Args::TargetIndex
def to_ruby
_vagrant_load_client(VagrantPlugins::CommandServe::Client::TargetIndex)

View File

@ -23,7 +23,8 @@ describe VagrantPlugins::CommandServe::Mappers do
)
output = subject.map(input, to: Hash)
expect(output).to eq({error_check: false})
expect(output["error_check"]).to eq(false)
expect(output[:error_check]).to eq(false)
end
end

View File

@ -88,7 +88,7 @@ describe VagrantPlugins::CommandServe::Service::GuestService do
end
after do
VagrantPlugins::CommandServe::Service.cache.clear
VagrantPlugins::CommandServe.cache.clear
end
it "generates a spec" do

View File

@ -94,7 +94,7 @@ describe VagrantPlugins::CommandServe::Service::HostService do
end
after do
VagrantPlugins::CommandServe::Service.cache.clear
VagrantPlugins::CommandServe.cache.clear
end
it "generates a spec" do

View File

@ -11,6 +11,7 @@ describe Vagrant::Machine::Remote do
# difference is the above klass is used so we can prepend the remote stuff
let(:name) { "foo" }
let(:ui) { double(:ui) }
let(:provider) { new_provider_mock }
let(:provider_cls) do
obj = double("provider_cls")
@ -28,6 +29,16 @@ describe Vagrant::Machine::Remote do
allow(b).to receive(:version).and_return("1.0")
end
end
let(:config) do
double("config").tap do |c|
allow(c).to receive(:trigger).and_return( double(:trigger) )
end
end
let(:vagrantfile) do
double("vagrantfile").tap do |v|
allow(v).to receive(:config).and_return( config )
end
end
let(:config) { env.vagrantfile.config }
let(:data_dir) { Pathname.new(Dir.mktmpdir("vagrant-machine-data-dir")) }
@ -70,7 +81,7 @@ describe Vagrant::Machine::Remote do
def new_instance
klass.new(name, provider_name, provider_cls, provider_config,
provider_options, config, data_dir, box,
env, env.vagrantfile, base)
env, env.vagrantfile, base, client: client)
end
# == Machine::Remote Setup
@ -80,12 +91,17 @@ describe Vagrant::Machine::Remote do
before do
allow(env).to receive(:ui).and_return(ui)
allow(env).to receive(:get_target) { client }
allow(client).to receive(:box) { box }
allow(client).to receive(:data_dir) { data_dir }
allow(client).to receive(:name) { name }
allow(client).to receive(:provider_name) { provider_name }
allow(client).to receive(:provider) { nil }
allow(client).to receive(:environment) { env }
allow(client).to receive(:vagrantfile) { vagrantfile }
allow(ui).to receive(:machine)
allow(Vagrant.plugin("2").remote_manager).to receive(:providers) { {provider_name => provider_cls} }
end