Use instance doubles for driver where possible (#1491)

Switch to instance doubles for driver where possible and reduce usage of
allow_any_instance_of.

Additionally replace some incorrect allows with expects to validate
calls are not made.
This commit is contained in:
Darragh Bailey
2022-05-06 20:30:55 +01:00
committed by GitHub
parent 4ffb63cd79
commit e4122f480a
10 changed files with 12 additions and 31 deletions

View File

@@ -26,9 +26,6 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomainVolume do
describe '#call' do
before do
allow_any_instance_of(VagrantPlugins::ProviderLibvirt::Driver)
.to receive(:connection).and_return(connection)
allow(connection).to receive(:client).and_return(libvirt_client)
allow(connection).to receive(:volumes).and_return(volumes)
allow(volumes).to receive(:all).and_return(all)
allow(all).to receive(:first).and_return(box_volume)