diff options
author | Luke Kanies <luke@madstop.com> | 2009-11-01 14:47:53 -0500 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 9a78beee0e4dadeaaff0c7b6a5f659f147f108c8 (patch) | |
tree | 08a9bc41d4b2d705ad89447f0df8af231e21bbb3 | |
parent | f2ed655d5e5a9b7c61b29cda229b63db2d73064e (diff) | |
download | puppet-9a78beee0e4dadeaaff0c7b6a5f659f147f108c8.tar.gz puppet-9a78beee0e4dadeaaff0c7b6a5f659f147f108c8.tar.xz puppet-9a78beee0e4dadeaaff0c7b6a5f659f147f108c8.zip |
Adding tests for the 'report' log destination
Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r-- | lib/puppet/util/log.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util/log/destinations.rb | 2 | ||||
-rwxr-xr-x | spec/unit/util/log/destinations.rb | 24 |
3 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 997aa1810..50111ab0d 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 40e41c061..b11aa2b0c 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 000000000..0bc416e74 --- /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 |