diff options
author | Bryan McLellan <btm@loftninjas.org> | 2017-11-22 13:25:18 -0500 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-11-22 13:42:02 -0500 |
commit | cef9ea636ab110b24b5703cce1455db69706d6be (patch) | |
tree | dc861cfed42bd41f3115ea861179d64bd90eae61 /spec/unit/provider/ifconfig_spec.rb | |
parent | 7430c834fb1a95a724d14da528b75a7e07dfe6ca (diff) | |
download | chef-cef9ea636ab110b24b5703cce1455db69706d6be.tar.gz |
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 <btm@loftninjas.org>
Diffstat (limited to 'spec/unit/provider/ifconfig_spec.rb')
-rw-r--r-- | spec/unit/provider/ifconfig_spec.rb | 13 |
1 files 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 |