diff --git a/lib/vagrant/actions/vm/destroy.rb b/lib/vagrant/actions/vm/destroy.rb index 45fc92438..b65f883de 100644 --- a/lib/vagrant/actions/vm/destroy.rb +++ b/lib/vagrant/actions/vm/destroy.rb @@ -5,17 +5,18 @@ module Vagrant def execute! @runner.invoke_around_callback(:destroy) do destroy_vm - depersist + update_dotfile end end def destroy_vm logger.info "Destroying VM and associated drives..." @runner.vm.destroy(:destroy_medium => :delete) + @runner.vm = nil end - def depersist - @runner.env.depersist_vm + def update_dotfile + @runner.env.update_dotfile end end end diff --git a/test/vagrant/actions/vm/destroy_test.rb b/test/vagrant/actions/vm/destroy_test.rb index 4b747dc53..896c9d583 100644 --- a/test/vagrant/actions/vm/destroy_test.rb +++ b/test/vagrant/actions/vm/destroy_test.rb @@ -15,7 +15,7 @@ class DestroyActionTest < Test::Unit::TestCase @runner.stubs(:invoke_around_callback).yields clear_seq = sequence("clear") @action.expects(:destroy_vm).in_sequence(clear_seq) - @action.expects(:depersist).in_sequence(clear_seq) + @action.expects(:update_dotfile).in_sequence(clear_seq) @action.execute! end end @@ -23,14 +23,15 @@ class DestroyActionTest < Test::Unit::TestCase context "destroying the VM" do should "destroy VM and attached images" do @vm.expects(:destroy).with(:destroy_medium => :delete).once + @runner.expects(:vm=).with(nil).once @action.destroy_vm end end - context "depersisting" do - should "call depersist_vm on Env" do - @runner.env.expects(:depersist_vm).once - @action.depersist + context "updating the dotfile" do + should "update the environment dotfile" do + @runner.env.expects(:update_dotfile).once + @action.update_dotfile end end end