[Pkg-puppet-devel] [facter] 200/352: (maint) Simplify argument handling for `warn` messages

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 421748c99e4b163be87b34ddd62b7f4ca290f14c
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Mon Feb 3 11:03:50 2014 -0800

    (maint) Simplify argument handling for `warn` messages
    
    `Facter::Core::Logging.warn` could accept a string or Array of strings,
    but it adds needless complexity and can be better handled by calling
    classes. This simplifies the warn method to accept and log a string.
---
 lib/facter/core/logging.rb     | 3 +--
 spec/unit/core/logging_spec.rb | 8 --------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/facter/core/logging.rb b/lib/facter/core/logging.rb
index b908daf..a573f4a 100644
--- a/lib/facter/core/logging.rb
+++ b/lib/facter/core/logging.rb
@@ -53,8 +53,7 @@ module Facter::Core::Logging
   # @return [void]
   def warn(msg)
     if self.debugging? and msg and not msg.empty?
-      msg = [msg] unless msg.respond_to? :each
-      msg.each { |line| Kernel.warn line }
+      Kernel.warn msg
     end
   end
 
diff --git a/spec/unit/core/logging_spec.rb b/spec/unit/core/logging_spec.rb
index 2258912..44ae3c5 100644
--- a/spec/unit/core/logging_spec.rb
+++ b/spec/unit/core/logging_spec.rb
@@ -33,14 +33,6 @@ describe Facter::Core::Logging do
       Kernel.expects(:warn).never
       subject.warn('foo')
     end
-
-    it "should warn for any given element for an array if debugging is enabled" do
-      subject.debugging(true)
-      Kernel.stubs(:warn)
-      Kernel.expects(:warn).with('foo')
-      Kernel.expects(:warn).with('bar')
-      subject.warn( ['foo','bar'])
-    end
   end
 
   describe "when warning once" do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list