[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:30:49 UTC 2010


The following commit has been merged in the upstream branch:
commit c6dd180450404c74bac8aadbf68b297c5f74764c
Author: Luke Kanies <luke at madstop.com>
Date:   Wed Nov 4 16:52:47 2009 -0600

    Adding tests for "Logging" module
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/spec/unit/util/logging.rb b/spec/unit/util/logging.rb
new file mode 100755
index 0000000..39edbb4
--- /dev/null
+++ b/spec/unit/util/logging.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+require 'puppet/util/logging'
+
+class LoggingTester
+    include Puppet::Util::Logging
+end
+
+describe Puppet::Util::Logging do
+    before do
+        @logger = LoggingTester.new
+    end
+
+    Puppet::Util::Log.eachlevel do |level|
+        it "should have a method for sending '#{level}' logs" do
+            @logger.should respond_to(level)
+        end
+    end
+
+    describe "when sending a log" do
+        it "should use the Log's 'create' entrance method" do
+            Puppet::Util::Log.expects(:create)
+
+            @logger.notice "foo"
+        end
+
+        it "should send itself as the log source" do
+            Puppet::Util::Log.expects(:create).with { |args| args[:source].equal?(@logger) }
+
+            @logger.notice "foo"
+        end
+
+        it "should send the provided argument as the log message" do
+            Puppet::Util::Log.expects(:create).with { |args| args[:message] == "foo" }
+
+            @logger.notice "foo"
+        end
+
+        it "should join any provided arguments into a single string for the message" do
+            Puppet::Util::Log.expects(:create).with { |args| args[:message] == "foo bar baz" }
+
+            @logger.notice ["foo", "bar", "baz"]
+        end
+    end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list