Validate partial mocks (#1417)

Switch to using explicit references to objects to be partially mocked
and remove the need to resolve the string constants as this will catch
more instances of calls to invalid or missing methods.

Rework how the vm is added to the machine for one of the tests as it is
not a method and instead is provided via internal state being exposed
with a helper.
This commit is contained in:
Darragh Bailey
2021-12-03 11:28:21 +00:00
committed by GitHub
parent 5914f0cffd
commit 27a541bba9
5 changed files with 9 additions and 11 deletions

View File

@@ -607,7 +607,9 @@ describe VagrantPlugins::ProviderLibvirt::Config do
context 'with mac defined' do
let (:vm) { double('vm') }
before { expect(machine.config).to receive(:vm).and_return(vm) }
before do
machine.config.instance_variable_get("@keys")[:vm] = vm
end
it 'is valid with valid mac' do
expect(vm).to receive(:networks).and_return([[:public, { mac: 'aa:bb:cc:dd:ee:ff' }]])