From 36b38b76649d8015a627ea558f2626764ee9a243 Mon Sep 17 00:00:00 2001 From: Facundo Guerrero Date: Thu, 27 Mar 2014 15:25:12 -0300 Subject: [PATCH 1/2] add expect for warn message --- spec/unit/action/sudo_forward_ports_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/unit/action/sudo_forward_ports_spec.rb b/spec/unit/action/sudo_forward_ports_spec.rb index e888bcb..b81e559 100644 --- a/spec/unit/action/sudo_forward_ports_spec.rb +++ b/spec/unit/action/sudo_forward_ports_spec.rb @@ -33,6 +33,7 @@ describe Vagrant::LXC::Action::ForwardPorts do it 'forwards ports using redir' do subject.stub(system: true) subject.call(env) + expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --laddr=#{host_ip} --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" ) @@ -42,6 +43,7 @@ describe Vagrant::LXC::Action::ForwardPorts do forward_conf.delete(:host_ip) subject.stub(system: true) subject.call(env) + expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" ) @@ -51,6 +53,7 @@ describe Vagrant::LXC::Action::ForwardPorts do forward_conf[:host_ip] = ' ' subject.stub(system: true) subject.call(env) + expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" ) From d8d371984bc0de661e7b80f53cc02a4df2a1dcb3 Mon Sep 17 00:00:00 2001 From: idontdomath Date: Sat, 29 Mar 2014 20:21:14 -0300 Subject: [PATCH 2/2] enabled warning on the used environment for forward ports spec. removed warn checks on test were the condition didn't apply. --- spec/unit/action/sudo_forward_ports_spec.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spec/unit/action/sudo_forward_ports_spec.rb b/spec/unit/action/sudo_forward_ports_spec.rb index b81e559..77602ae 100644 --- a/spec/unit/action/sudo_forward_ports_spec.rb +++ b/spec/unit/action/sudo_forward_ports_spec.rb @@ -6,7 +6,7 @@ require 'vagrant-lxc/action/forward_ports' describe Vagrant::LXC::Action::ForwardPorts do let(:app) { double(:app, call: true) } - let(:env) { {machine: machine, ui: double(info: true)} } + let(:env) { {machine: machine, ui: double(info: true, warn: true)} } let(:machine) { double(:machine) } let!(:data_dir) { Pathname.new(Dir.mktmpdir) } let(:provider) { double(Vagrant::LXC::Provider, ssh_info: {host: container_ip}) } @@ -33,7 +33,6 @@ describe Vagrant::LXC::Action::ForwardPorts do it 'forwards ports using redir' do subject.stub(system: true) subject.call(env) - expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --laddr=#{host_ip} --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" ) @@ -43,7 +42,6 @@ describe Vagrant::LXC::Action::ForwardPorts do forward_conf.delete(:host_ip) subject.stub(system: true) subject.call(env) - expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" ) @@ -53,7 +51,6 @@ describe Vagrant::LXC::Action::ForwardPorts do forward_conf[:host_ip] = ' ' subject.stub(system: true) subject.call(env) - expect(env).to have_received(:warn) expect(subject).to have_received(:spawn).with( "sudo redir --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null" )