From b461e0ee8ba28f0872045a1fd55921317bcf9ff0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 19 Mar 2010 16:48:36 -0700 Subject: [PATCH] `vagrant halt` uses new environment --- lib/vagrant/commands.rb | 6 +++--- test/vagrant/commands_test.rb | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/commands.rb b/lib/vagrant/commands.rb index 476b43426..1b3372df4 100644 --- a/lib/vagrant/commands.rb +++ b/lib/vagrant/commands.rb @@ -125,9 +125,9 @@ msg # This command requires than an instance already be brought up with # `vagrant up`. def halt - Env.load! - Env.require_persisted_vm - Env.persisted_vm.execute!(Actions::VM::Halt) + env = Environment.load! + env.require_persisted_vm + env.vm.execute!(Actions::VM::Halt) end # Suspend a running vagrant instance. This suspends the instance, saving diff --git a/test/vagrant/commands_test.rb b/test/vagrant/commands_test.rb index aba6b7811..6a316d8e0 100644 --- a/test/vagrant/commands_test.rb +++ b/test/vagrant/commands_test.rb @@ -140,8 +140,13 @@ class CommandsTest < Test::Unit::TestCase end context "halt" do + should "load the current environment" do + Vagrant::Environment.expects(:load!).once.returns(@env) + Vagrant::Commands.halt + end + should "require a persisted VM" do - Vagrant::Env.expects(:require_persisted_vm).once + @env.expects(:require_persisted_vm).once Vagrant::Commands.halt end