Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created June 29, 2013 09:03
Show Gist options
  • Select an option

  • Save domcleal/5890455 to your computer and use it in GitHub Desktop.

Select an option

Save domcleal/5890455 to your computer and use it in GitHub Desktop.
diff --git a/spec/unit/macaddress_spec.rb b/spec/unit/macaddress_spec.rb
index 638ef2a..d219dfe 100755
--- a/spec/unit/macaddress_spec.rb
+++ b/spec/unit/macaddress_spec.rb
@@ -49,6 +49,14 @@ describe "macaddress fact" do
proc { Facter.value(:macaddress) }.should_not raise_error
Facter.value(:macaddress).should be_nil
end
+
+ # when ifconfig isn't installed, nil is returned which should be handled gracefully without any
+ # errors raised
+ it "should not raise any errors when nil is returned" do
+ Facter::Util::IP.expects(:exec_ifconfig).at_least_once.with(["-a","2>/dev/null"]).
+ returns(nil)
+ expect { Facter.value(:macaddress) }.not_to have_printed('Could not retrieve macaddress')
+ end
end
describe "when run on BSD" do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment