[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:40 UTC 2010


The following commit has been merged in the upstream branch:
commit 9a78beee0e4dadeaaff0c7b6a5f659f147f108c8
Author: Luke Kanies <luke at madstop.com>
Date:   Sun Nov 1 14:47:53 2009 -0500

    Adding tests for the 'report' log destination
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 997aa18..50111ab 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -35,6 +35,8 @@ class Puppet::Util::Log
     class << self
         include Puppet::Util
         include Puppet::Util::ClassGen
+
+        attr_reader :desttypes
     end
 
     # Reset all logs to basics.  Basically just closes all files and undefs
diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index 40e41c0..b11aa2b 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -200,6 +200,8 @@ end
 
 # Log to a transaction report.
 Puppet::Util::Log.newdesttype :report do
+    attr_reader :report
+
     match "Puppet::Transaction::Report"
 
     def initialize(report)
diff --git a/spec/unit/util/log/destinations.rb b/spec/unit/util/log/destinations.rb
new file mode 100755
index 0000000..0bc416e
--- /dev/null
+++ b/spec/unit/util/log/destinations.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+require 'puppet/util/log'
+
+describe Puppet::Util::Log.desttypes[:report] do
+    before do
+        @dest = Puppet::Util::Log.desttypes[:report]
+    end
+
+    it "should require a report at initialization" do
+        @dest.new("foo").report.should == "foo"
+    end
+
+    it "should send new messages to the report" do
+        report = mock 'report'
+        dest = @dest.new(report)
+
+        report.expects(:newlog).with("my log")
+
+        dest.handle "my log"
+    end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list