From 62d3172e573690d52f625512dcb851ca5b2e4d20 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 14 Mar 2010 16:28:36 -0700 Subject: [PATCH] VM now has a `uuid` method --- lib/vagrant/vm.rb | 4 ++++ test/vagrant/vm_test.rb | 8 ++++++++ 2 files changed, 12 insertions(+) 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")