From eec60d7bdd1f3d7efd77227b52d697f5988f5980 Mon Sep 17 00:00:00 2001 From: Jeff Bonhag Date: Mon, 9 Dec 2019 16:18:04 -0500 Subject: [PATCH] Stub #is_port_open? Stub #is_port_open? so we don't need to worry about tests colliding with real services. --- .../builtin/handle_forwarded_port_collisions_test.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb b/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb index 71b848102..3bc56d840 100644 --- a/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb +++ b/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb @@ -69,18 +69,19 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do end context "with forwarded port defined" do - let(:port_options){ {guest: 80, host: 52811} } + let(:port_options){ {guest: 80, host: 8080} } before do expect(vm_config).to receive(:networks).and_return([[:forwarded_port, port_options]]).twice end it "should check if host port is in use" do expect(instance).to receive(:is_forwarded_already).and_return false + expect(instance).to receive(:is_port_open?).and_return false instance.call(env) end context "with forwarded port already in use" do - let(:extra_in_use){ [52811] } + let(:extra_in_use){ [8080] } it "should raise a port collision error" do expect{ instance.call(env) }.to raise_error(Vagrant::Errors::ForwardPortCollision) @@ -105,7 +106,7 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do context "with custom port_check method" do let(:check_result){ [] } - let(:port_options){ {guest: 80, host: 52811, host_ip: "127.0.1.1"} } + let(:port_options){ {guest: 80, host: 8080, host_ip: "127.0.1.1"} } context "that accepts two parameters" do let(:collision_port_check) do @@ -145,7 +146,7 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do describe "#port_check" do let(:host_ip){ "127.0.0.1" } - let(:host_port){ 52811 } + let(:host_port){ 8080 } it "should check if the port is open" do expect(instance).to receive(:is_port_open?).with(host_ip, host_port).and_return true