Hyperv: add tests for --force flag support for stop VM

This commit is contained in:
Pavel Rusin 2021-07-05 17:33:07 +03:00
parent 3bb828a8d9
commit 2de0d7e79c

View file

@ -0,0 +1,29 @@
require_relative "../../../../base"
require Vagrant.source_root.join("plugins/providers/hyperv/action/halt_instance")
describe VagrantPlugins::HyperV::Action::HaltInstance do
let(:app){ double("app") }
let(:env){ {ui: ui, machine: machine} }
let(:ui){ double("ui") }
let(:provider){ double("provider", driver: driver) }
let(:driver){ double("driver") }
let(:machine){ double("machine", provider: provider, data_dir: "/dev/null") }
let(:subject){ described_class.new(app, env) }
before do
allow(app).to receive(:call)
allow(ui).to receive(:info)
allow(driver).to receive(:halt)
end
it "should call the app on success" do
expect(app).to receive(:call)
subject.call(env)
end
it "should call the driver to halt the vm" do
expect(driver).to receive(:halt)
subject.call(env)
end
end