Add delete vm action checks for data directory removal and creation
This commit is contained in:
parent
69ece0db4e
commit
ed2af17e45
|
@ -8,13 +8,15 @@ describe VagrantPlugins::HyperV::Action::DeleteVM do
|
||||||
let(:ui){ double("ui") }
|
let(:ui){ double("ui") }
|
||||||
let(:provider){ double("provider", driver: driver) }
|
let(:provider){ double("provider", driver: driver) }
|
||||||
let(:driver){ double("driver") }
|
let(:driver){ double("driver") }
|
||||||
let(:machine){ double("machine", provider: provider) }
|
let(:machine){ double("machine", provider: provider, data_dir: "/dev/null") }
|
||||||
let(:subject){ described_class.new(app, env) }
|
let(:subject){ described_class.new(app, env) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(app).to receive(:call)
|
allow(app).to receive(:call)
|
||||||
allow(ui).to receive(:info)
|
allow(ui).to receive(:info)
|
||||||
allow(driver).to receive(:delete_vm)
|
allow(driver).to receive(:delete_vm)
|
||||||
|
allow(FileUtils).to receive(:rm_rf)
|
||||||
|
allow(FileUtils).to receive(:mkdir_p)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should call the app on success" do
|
it "should call the app on success" do
|
||||||
|
@ -26,4 +28,14 @@ describe VagrantPlugins::HyperV::Action::DeleteVM do
|
||||||
expect(driver).to receive(:delete_vm)
|
expect(driver).to receive(:delete_vm)
|
||||||
subject.call(env)
|
subject.call(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should delete the data directory" do
|
||||||
|
expect(FileUtils).to receive(:rm_rf).with(machine.data_dir)
|
||||||
|
subject.call(env)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should recreate the data directory" do
|
||||||
|
expect(FileUtils).to receive(:mkdir_p).with(machine.data_dir)
|
||||||
|
subject.call(env)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue