Clear shared folders uses new modify pipeline

This commit is contained in:
Mitchell Hashimoto 2011-07-08 12:05:18 -07:00
parent 79c46b4ec1
commit d797e48389
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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