Skip to content

Commit

Permalink
Clear shared folders uses new modify pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jul 8, 2011
1 parent 79c46b4 commit d797e48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/vagrant/action/vm/clear_shared_folders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(app, env)
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")

Expand All @@ -18,6 +18,7 @@ def call(env)
end
end

env["vm.modify"].call(proc)
@app.call(env)
end
end
Expand Down
7 changes: 6 additions & 1 deletion test/vagrant/action/vm/clear_shared_folders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d797e48

Please sign in to comment.