Forward ports now uses modify pipeline

This commit is contained in:
Mitchell Hashimoto 2011-07-08 12:04:01 -07:00
parent 027b22eca0
commit 79c46b4ec1
2 changed files with 10 additions and 3 deletions

View File

@ -83,11 +83,12 @@ module Vagrant
def call(env)
@env = env
@env["config"].vm.customize do |vm|
@env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
proc = lambda do |vm|
env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
forward_ports(vm)
end
env["vm.modify"].call(proc)
@app.call(env)
end

View File

@ -8,6 +8,7 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
@vm = mock("vm")
@vm.stubs(:name).returns("foo")
@env["vm"] = @vm
@env["vm.modify"] = mock("proc")
end
context "initializing" do
@ -123,7 +124,12 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
context "calling" do
should "clear all previous ports and forward new ports" do
exec_seq = sequence("exec_seq")
@env["config"].vm.expects(:customize).yields(@internal_vm).in_sequence(exec_seq)
@env["vm.modify"].expects(:call).with() do |proc|
proc.call(@internal_vm)
true
end
@instance.expects(:forward_ports).once.in_sequence(exec_seq)
@app.expects(:call).once.with(@env).in_sequence(exec_seq)
@instance.call(@env)