From 3ea373c3410a0b7874b9f2317d88c695368ed3b3 Mon Sep 17 00:00:00 2001 From: Bryan McLellan Date: Wed, 22 Nov 2017 13:25:18 -0500 Subject: Stub out call to 'ifconfig --version' in unit tests A recent change to the ifconfig provider added a new shellout call without a corresponding stub added to the unit tests. Signed-off-by: Bryan McLellan --- spec/unit/provider/ifconfig_spec.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index da27d647ee..3732d75cc9 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -38,12 +38,19 @@ describe Chef::Provider::Ifconfig do status = double("Status", exitstatus: 0) @provider.instance_variable_set("@status", status) @provider.current_resource = @current_resource - end + describe Chef::Provider::Ifconfig, "load_current_resource" do + let(:net_tools_version) { StringIO.new <<-EOS } +net-tools 1.60 +ifconfig 1.42 (2001-04-13) +EOS + before do - @status = double(stdout: "", exitstatus: 1) - allow(@provider).to receive(:shell_out).and_return(@status) + ifconfig = double(stdout: "", exitstatus: 1) + allow(@provider).to receive(:shell_out).and_return(ifconfig) + ifconfig_version = double(stdout: "", stderr: net_tools_version, exitstatus: 4) + allow(@provider).to receive(:shell_out).with("ifconfig --version").and_return(ifconfig_version) @provider.load_current_resource end it "should track state of ifconfig failure" do -- cgit v1.2.1