Forward ports now uses modify pipeline
This commit is contained in:
parent
027b22eca0
commit
79c46b4ec1
|
@ -83,11 +83,12 @@ module Vagrant
|
||||||
def call(env)
|
def call(env)
|
||||||
@env = env
|
@env = env
|
||||||
|
|
||||||
@env["config"].vm.customize do |vm|
|
proc = lambda do |vm|
|
||||||
@env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
|
env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
|
||||||
forward_ports(vm)
|
forward_ports(vm)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
env["vm.modify"].call(proc)
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
|
||||||
@vm = mock("vm")
|
@vm = mock("vm")
|
||||||
@vm.stubs(:name).returns("foo")
|
@vm.stubs(:name).returns("foo")
|
||||||
@env["vm"] = @vm
|
@env["vm"] = @vm
|
||||||
|
@env["vm.modify"] = mock("proc")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "initializing" do
|
context "initializing" do
|
||||||
|
@ -123,7 +124,12 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
|
||||||
context "calling" do
|
context "calling" do
|
||||||
should "clear all previous ports and forward new ports" do
|
should "clear all previous ports and forward new ports" do
|
||||||
exec_seq = sequence("exec_seq")
|
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)
|
@instance.expects(:forward_ports).once.in_sequence(exec_seq)
|
||||||
@app.expects(:call).once.with(@env).in_sequence(exec_seq)
|
@app.expects(:call).once.with(@env).in_sequence(exec_seq)
|
||||||
@instance.call(@env)
|
@instance.call(@env)
|
||||||
|
|
Loading…
Reference in New Issue