]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(maint) Fix spec failures resulting from Facter API changes
authorJeff McCune <jeff@puppetlabs.com>
Thu, 25 Oct 2012 22:32:34 +0000 (15:32 -0700)
committerJeff McCune <jeff@puppetlabs.com>
Thu, 25 Oct 2012 22:36:54 +0000 (15:36 -0700)
Without this patch stdlib tests fail against Facter 2.x and master but
not 1.6.x.

This patch fixes the problem by initializing the example group
differently depending on the version of Facter integrating into the
system.  The adjusted methods are:

 1.x - Facter.collection.loader.load
 2.x - Facter.collection.load

The collection actually implements the load method in both version, it's
simply marked as private in 1.x.

spec/unit/facter/pe_version_spec.rb

index 202a0e574548413c25d1da86d5015f797d3b6bf1..931c6d4b0a3cc598cbd45710bd37e29c38d84d55 100644 (file)
@@ -4,7 +4,15 @@ require 'spec_helper'
 
 describe "PE Version specs" do
   before :each do
-    Facter.collection.loader.load(:pe_version)
+    # Explicitly load the pe_version.rb file which contains generated facts
+    # that cannot be automatically loaded.  Puppet 2.x implements
+    # Facter.collection.load while Facter 1.x markes Facter.collection.load as
+    # a private method.
+    if Facter.collection.respond_to? :load
+      Facter.collection.load(:pe_version)
+    else
+      Facter.collection.loader.load(:pe_version)
+    end
   end
 
   context "If PE is installed" do