Please review pull request #44: (maint) Fix failing spec test on Ruby 1.9.3 opened by (kelseyhightower)

Description:

Without this patch the specs tests do no pass on Ruby 1.9. The output
for Load Errors has changed between Ruby 1.8.7 and 1.9.3. This causes
the Hiera#logger spec to fail on Ruby 1.9.3 as we are relying on the
output from 1.8.7.

Instead of relying on a string which is subject to change in the future,
we are now checking that the correct logger is being used.

  • Opened: Tue Apr 24 20:26:02 UTC 2012
  • Based on: puppetlabs:master (dbfd0eb66a71c5444bfb9ab1828c21dc227416a4)
  • Requested merge: kelseyhightower:maint/master/fix_failing_spec_on_19 (602c526ac4da93dfbc66cb48bd721ee0c1640f1e)

Diff follows:

diff --git a/lib/hiera.rb b/lib/hiera.rb
index 2afa589..2068ab3 100644
--- a/lib/hiera.rb
+++ b/lib/hiera.rb
@@ -10,6 +10,8 @@ class Hiera
   autoload :Puppet_logger, "hiera/puppet_logger"
 
   class << self
+    attr_reader :logger
+
     def version
       VERSION
     end
diff --git a/spec/unit/hiera_spec.rb b/spec/unit/hiera_spec.rb
index 0be86c4..86c5992 100644
--- a/spec/unit/hiera_spec.rb
+++ b/spec/unit/hiera_spec.rb
@@ -9,8 +9,9 @@
     end
 
     it "should fall back to the Console logger on failure" do
-      Hiera.expects(:warn).with("Failed to load foo logger: LoadError: no such file to load -- hiera/foo_logger")
+      Hiera.expects(:warn)
       Hiera.logger = "foo"
+      Hiera.logger.should be Hiera::Console_logger
     end
   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