hobo-down now properly uses the new Hobo::VM object rather than a pure VBox VM object.

This commit is contained in:
Mitchell Hashimoto 2010-01-31 18:12:09 -08:00
parent 652a157d51
commit 32816419f5
2 changed files with 14 additions and 4 deletions

View File

@ -12,9 +12,7 @@ module Hobo
# Tear down a virtual machine.
def down
Env.require_persisted_vm
HOBO_LOGGER.info "Destroying VM and associated drives..."
Env.persisted_vm.destroy(:destroy_image => true)
Env.persisted_vm.destroy
end
# Finds a virtual machine by a given UUID and either returns
@ -38,6 +36,11 @@ module Hobo
setup_shared_folder
end
def destroy
HOBO_LOGGER.info "Destroying VM and associated drives..."
@vm.destroy(:destroy_image => true)
end
def import
HOBO_LOGGER.info "Importing base VM (#{Hobo.config[:vm][:base]})..."
@vm = VirtualBox::VM.import(File.expand_path(Hobo.config[:vm][:base]))

View File

@ -19,7 +19,7 @@ class VMTest < Test::Unit::TestCase
end
should "destroy the persisted VM and the VM image" do
@persisted_vm.expects(:destroy).with(:destroy_image => true).once
@persisted_vm.expects(:destroy).once
Hobo::VM.down
end
end
@ -64,6 +64,13 @@ class VMTest < Test::Unit::TestCase
end
end
context "destroying" do
should "destoy the VM along with images" do
@mock_vm.expects(:destroy).with(:destroy_image => true).once
@vm.destroy
end
end
context "importing" do
should "call import on VirtualBox::VM with the proper base" do
VirtualBox::VM.expects(:import).once