Please review pull request #195: Ticket/1.6.x/14332 ubuntu stubbing opened by (kbarber)

Description:

The tests for facter fail on Ubuntu because lsbdistid is not correctly stubbed.
This patch fixes that small mistake by stubbing lsbdistid for all Linux tests,
except where the test is really about testing for Ubuntu.

  • Opened: Sun May 06 00:13:37 UTC 2012
  • Based on: puppetlabs:1.6.x (cbae1d573cf3751aef85b2771c1bbaf63eb6c5a6)
  • Requested merge: kbarber:ticket/1.6.x/14332_ubuntu_stubbing (6c46b2cc4df5edc71e250e99b4f65604e4010670)

Diff follows:

diff --git a/spec/unit/operatingsystem_spec.rb b/spec/unit/operatingsystem_spec.rb
index 89a18c4..59069a1 100755
--- a/spec/unit/operatingsystem_spec.rb
+++ b/spec/unit/operatingsystem_spec.rb
@@ -37,6 +37,9 @@
   describe "on Linux" do
     before :each do
       Facter.fact(:kernel).stubs(:value).returns("Linux")
+
+      # Always stub lsbdistid by default, so tests work on Ubuntu
+      Facter.stubs(:value).with(:lsbdistid).returns(nil)
     end
 
     {
@@ -69,7 +72,7 @@
       it "on Ubuntu should use the lsbdistid fact" do
         FileUtils.stubs(:exists?).with("/etc/debian_version").returns true
 
-        Facter.fact(:lsbdistid).expects(:value).returns("Ubuntu")
+        Facter.stubs(:value).with(:lsbdistid).returns("Ubuntu")
         Facter.fact(:operatingsystem).value.should == "Ubuntu"
       end
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to