diff --git a/lib/vagrant/vm.rb b/lib/vagrant/vm.rb index 56a0d6b84..3fb06de29 100644 --- a/lib/vagrant/vm.rb +++ b/lib/vagrant/vm.rb @@ -19,6 +19,10 @@ module Vagrant @vm = vm end + def uuid + @vm.uuid + end + def reload! @vm = VirtualBox::VM.find(@vm.uuid) end diff --git a/test/vagrant/vm_test.rb b/test/vagrant/vm_test.rb index 623acd16c..bd9167074 100644 --- a/test/vagrant/vm_test.rb +++ b/test/vagrant/vm_test.rb @@ -38,6 +38,14 @@ class VMTest < Test::Unit::TestCase @mock_vm.stubs(:uuid).returns("foo") 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 should "load the same VM and set it" do new_vm = mock("vm")