Add machine config to machine double for rspec tests

This commit mocks up the docker machines test config so that it doesn't
actually invoke the docker driver in circle-ci
This commit is contained in:
Brian Cain 2019-09-11 08:09:26 -07:00
parent ebe1f3f1c9
commit 21db2db9ac
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
4 changed files with 36 additions and 0 deletions

View File

@ -13,8 +13,17 @@ describe VagrantPlugins::DockerProvider::Action::ConnectNetworks do
sandbox.create_vagrant_env
end
let(:vm_config) { double("machine_vm_config") }
let(:machine_config) do
double("machine_config").tap do |top_config|
allow(top_config).to receive(:vm).and_return(vm_config)
end
end
let(:machine) do
iso_env.machine(iso_env.machine_names[0], :docker).tap do |m|
allow(m).to receive(:config).and_return(machine_config)
allow(m).to receive(:id).and_return("12345")
allow(m.provider).to receive(:driver).and_return(driver)
allow(m.provider).to receive(:host_vm?).and_return(false)

View File

@ -12,8 +12,17 @@ describe VagrantPlugins::DockerProvider::Action::DestroyNetwork do
sandbox.create_vagrant_env
end
let(:vm_config) { double("machine_vm_config") }
let(:machine_config) do
double("machine_config").tap do |top_config|
allow(top_config).to receive(:vm).and_return(vm_config)
end
end
let(:machine) do
iso_env.machine(iso_env.machine_names[0], :docker).tap do |m|
allow(m).to receive(:config).and_return(machine_config)
allow(m.provider).to receive(:driver).and_return(driver)
allow(m.config.vm).to receive(:networks).and_return(networks)
end

View File

@ -15,9 +15,18 @@ describe VagrantPlugins::DockerProvider::Action::Login do
let(:provider_config) { double("provider_config", username: "docker", password: "") }
let(:vm_config) { double("machine_vm_config") }
let(:machine_config) do
double("machine_config").tap do |top_config|
allow(top_config).to receive(:vm).and_return(vm_config)
end
end
let(:machine) do
iso_env.machine(iso_env.machine_names[0], :docker).tap do |m|
allow(m).to receive(:id).and_return("12345")
allow(m).to receive(:config).and_return(machine_config)
allow(m).to receive(:provider_config).and_return(provider_config)
allow(m.provider).to receive(:driver).and_return(driver)
allow(m.provider).to receive(:host_vm?).and_return(false)

View File

@ -12,8 +12,17 @@ describe VagrantPlugins::DockerProvider::Action::PrepareNetworks do
sandbox.create_vagrant_env
end
let(:vm_config) { double("machine_vm_config") }
let(:machine_config) do
double("machine_config").tap do |top_config|
allow(top_config).to receive(:vm).and_return(vm_config)
end
end
let(:machine) do
iso_env.machine(iso_env.machine_names[0], :docker).tap do |m|
allow(m).to receive(:config).and_return(machine_config)
allow(m.provider).to receive(:driver).and_return(driver)
allow(m.config.vm).to receive(:networks).and_return(networks)
end