VM now has a `uuid` method

This commit is contained in:
Mitchell Hashimoto 2010-03-14 16:28:36 -07:00
parent 575e91e70b
commit 62d3172e57
2 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,10 @@ module Vagrant
@vm = vm @vm = vm
end end
def uuid
@vm.uuid
end
def reload! def reload!
@vm = VirtualBox::VM.find(@vm.uuid) @vm = VirtualBox::VM.find(@vm.uuid)
end end

View File

@ -38,6 +38,14 @@ class VMTest < Test::Unit::TestCase
@mock_vm.stubs(:uuid).returns("foo") @mock_vm.stubs(:uuid).returns("foo")
end end
context "uuid" do
should "call UUID on VM object" do
uuid = mock("uuid")
@mock_vm.expects(:uuid).once.returns(uuid)
assert_equal uuid, @vm.uuid
end
end
context "reloading" do context "reloading" do
should "load the same VM and set it" do should "load the same VM and set it" do
new_vm = mock("vm") new_vm = mock("vm")