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 3bc56d840..865c35248 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 @@ -75,8 +75,8 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do 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 + expect(instance).to receive(:is_forwarded_already).and_return(false) + expect(instance).to receive(:is_port_open?).and_return(false) instance.call(env) end @@ -149,7 +149,7 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do 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 + expect(instance).to receive(:is_port_open?).with(host_ip, host_port).and_return(true) instance.send(:port_check, host_ip, host_port) end @@ -157,13 +157,13 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do let(:host_ip){ nil } it "should set host_ip to 0.0.0.0 when unset" do - expect(instance).to receive(:is_port_open?).with("0.0.0.0", host_port).and_return true + expect(instance).to receive(:is_port_open?).with("0.0.0.0", host_port).and_return(true) instance.send(:port_check, host_ip, host_port) end it "should set host_ip to 127.0.0.1 when 0.0.0.0 is not available" do - expect(instance).to receive(:is_port_open?).with("0.0.0.0", host_port).and_raise Errno::EADDRNOTAVAIL - expect(instance).to receive(:is_port_open?).with("127.0.0.1", host_port).and_return true + expect(instance).to receive(:is_port_open?).with("0.0.0.0", host_port).and_raise(Errno::EADDRNOTAVAIL) + expect(instance).to receive(:is_port_open?).with("127.0.0.1", host_port).and_return(true) instance.send(:port_check, host_ip, host_port) end end diff --git a/test/unit/vagrant/util/is_port_open_test.rb b/test/unit/vagrant/util/is_port_open_test.rb index ff6109639..d931a8790 100644 --- a/test/unit/vagrant/util/is_port_open_test.rb +++ b/test/unit/vagrant/util/is_port_open_test.rb @@ -51,13 +51,13 @@ describe Vagrant::Util::IsPortOpen do end it "should handle connection refused" do - expect(TCPSocket).to receive(:new).with("0.0.0.0", closed_port).and_raise Errno::ECONNREFUSED + expect(TCPSocket).to receive(:new).with("0.0.0.0", closed_port).and_raise(Errno::ECONNREFUSED) expect(klass.is_port_open?("0.0.0.0", closed_port)).to be(false) end it "should raise an error if cannot assign requested address" do - expect(TCPSocket).to receive(:new).with("0.0.0.0", open_port).and_raise Errno::EADDRNOTAVAIL - expect { klass.is_port_open?("0.0.0.0", open_port) }.to raise_error Errno::EADDRNOTAVAIL + expect(TCPSocket).to receive(:new).with("0.0.0.0", open_port).and_raise(Errno::EADDRNOTAVAIL) + expect { klass.is_port_open?("0.0.0.0", open_port) }.to raise_error(Errno::EADDRNOTAVAIL) end end