diff --git a/lib/vagrant/action/vm/clear_shared_folders.rb b/lib/vagrant/action/vm/clear_shared_folders.rb index ec3c29387..d1352347f 100644 --- a/lib/vagrant/action/vm/clear_shared_folders.rb +++ b/lib/vagrant/action/vm/clear_shared_folders.rb @@ -8,7 +8,7 @@ module Vagrant end def call(env) - env["config"].vm.customize do |vm| + proc = lambda do |vm| if vm.shared_folders.length > 0 env.ui.info I18n.t("vagrant.actions.vm.clear_shared_folders.deleting") @@ -18,6 +18,7 @@ module Vagrant end end + env["vm.modify"].call(proc) @app.call(env) end end diff --git a/test/vagrant/action/vm/clear_shared_folders_test.rb b/test/vagrant/action/vm/clear_shared_folders_test.rb index 37519865f..a982c7041 100644 --- a/test/vagrant/action/vm/clear_shared_folders_test.rb +++ b/test/vagrant/action/vm/clear_shared_folders_test.rb @@ -7,6 +7,7 @@ class ClearSharedFoldersVMActionTest < Test::Unit::TestCase @vm = mock("vm") @env["vm"] = @vm + @env["vm.modify"] = mock("proc") @internal_vm = mock("internal") @vm.stubs(:vm).returns(@internal_vm) @@ -19,7 +20,6 @@ class ClearSharedFoldersVMActionTest < Test::Unit::TestCase @shared_folder = mock("shared_folder") @shared_folders = [@shared_folder] @internal_vm.stubs(:shared_folders).returns(@shared_folders) - @env["config"].vm.stubs(:customize).yields(@internal_vm) end should "call destroy on each shared folder then reload" do @@ -28,6 +28,11 @@ class ClearSharedFoldersVMActionTest < Test::Unit::TestCase sf.expects(:destroy).once.in_sequence(destroy_seq) end + @env["vm.modify"].expects(:call).with() do |proc| + proc.call(@internal_vm) + true + end + @app.expects(:call).with(@env).once @instance.call(@env) end