mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Update test syntax to remove stubs (#1138)
Use of stubs are deprecated, switch to the newer expect/allow syntax.
This commit is contained in:
@@ -25,6 +25,6 @@ shared_context 'libvirt' do
|
|||||||
# return some information for domain when needed
|
# return some information for domain when needed
|
||||||
allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')
|
allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')
|
||||||
|
|
||||||
machine.stub(id: id)
|
allow(machine).to receive(:id).and_return(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ shared_context 'unit' do
|
|||||||
let(:plugin) { register_plugin }
|
let(:plugin) { register_plugin }
|
||||||
|
|
||||||
before (:each) do
|
before (:each) do
|
||||||
machine.stub(guest: guest)
|
allow(machine).to receive(:guest).and_return(guest)
|
||||||
machine.stub(communicator: communicator)
|
allow(machine).to receive(:communicator).and_return(communicator)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::DestroyDomain do
|
|||||||
before do
|
before do
|
||||||
allow(libvirt_domain).to receive(:list_snapshots).and_return([])
|
allow(libvirt_domain).to receive(:list_snapshots).and_return([])
|
||||||
allow(libvirt_domain).to receive(:has_managed_save?).and_return(nil)
|
allow(libvirt_domain).to receive(:has_managed_save?).and_return(nil)
|
||||||
root_disk.stub(name: 'test.img')
|
allow(root_disk).to receive(:name).and_return('test.img')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when only has root disk' do
|
context 'when only has root disk' do
|
||||||
@@ -57,7 +57,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::DestroyDomain do
|
|||||||
|
|
||||||
let(:extra_disk) { double('libvirt_extra_disk') }
|
let(:extra_disk) { double('libvirt_extra_disk') }
|
||||||
before do
|
before do
|
||||||
extra_disk.stub(name: 'test-vdb.qcow2')
|
allow(extra_disk).to receive(:name).and_return('test-vdb.qcow2')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'destroys disks individually' do
|
it 'destroys disks individually' do
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ describe VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain do
|
|||||||
dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
|
dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
|
||||||
first = dmn.build_domain_name(@env)
|
first = dmn.build_domain_name(@env)
|
||||||
second = dmn.build_domain_name(@env)
|
second = dmn.build_domain_name(@env)
|
||||||
first.should_not eq(second)
|
expect(first).to_not eq(second)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'builds simple domain name' do
|
it 'builds simple domain name' do
|
||||||
@env.default_prefix = 'pre_'
|
@env.default_prefix = 'pre_'
|
||||||
dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
|
dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
|
||||||
dmn.build_domain_name(@env).should eq('pre_')
|
expect(dmn.build_domain_name(@env)).to eq('pre_')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user