[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:41 UTC 2010
The following commit has been merged in the upstream branch:
commit 5a8b460001337ac2971c9b8b9b61f600a86890bf
Author: Luke Kanies <luke at madstop.com>
Date: Sun Nov 1 14:57:18 2009 -0500
Removing unused code and adding a couple of tests
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 6a48633..0fb1db0 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -26,11 +26,6 @@ class Puppet::Transaction::Report
def initialize
@metrics = {}
@logs = []
-
- @records = Hash.new do |hash, key|
- hash[key] = []
- end
-
@host = Puppet[:certname]
end
@@ -54,10 +49,6 @@ class Puppet::Transaction::Report
@logs << msg
end
- def record(metric, object)
- @records[metric] << object
- end
-
# Provide a summary of this report.
def summary
ret = ""
diff --git a/spec/unit/transaction/report.rb b/spec/unit/transaction/report.rb
index 7cd5e14..e576f23 100755
--- a/spec/unit/transaction/report.rb
+++ b/spec/unit/transaction/report.rb
@@ -1,41 +1,61 @@
#!/usr/bin/env ruby
-#
-# Created by Luke Kanies on 2007-10-12.
-# Copyright (c) 2007. All rights reserved.
require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/transaction/report'
-describe Puppet::Transaction::Report, " when being indirect" do
- it "should redirect :find to the indirection" do
- @indirection = stub 'indirection', :name => :report
- Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find)
- Puppet::Transaction::Report.find(:report)
+describe Puppet::Transaction::Report do
+ it "should set its host name to the certname" do
+ Puppet.settings.expects(:value).with(:certname).returns "myhost"
+ Puppet::Transaction::Report.new.host.should == "myhost"
end
- it "should redirect :save to the indirection" do
- Facter.stubs(:value).returns("eh")
- @indirection = stub 'indirection', :name => :report
- Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
- report = Puppet::Transaction::Report.new
- @indirection.expects(:save)
- report.save
- end
+ describe "when accepting logs" do
+ before do
+ @report = Puppet::Transaction::Report.new
+ end
- it "should default to the 'processor' terminus" do
- Puppet::Transaction::Report.indirection.terminus_class.should == :processor
- end
+ it "should add new logs to the log list" do
+ @report << "log"
+ @report.logs[-1].should == "log"
+ end
- it "should delegate its name attribute to its host method" do
- report = Puppet::Transaction::Report.new
- report.expects(:host).returns "me"
- report.name.should == "me"
+ it "should return self" do
+ r = @report << "log"
+ r.should equal(@report)
+ end
end
- after do
- Puppet::Util::Cacher.expire
+ describe "when using the indirector" do
+ it "should redirect :find to the indirection" do
+ @indirection = stub 'indirection', :name => :report
+ Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
+ @indirection.expects(:find)
+ Puppet::Transaction::Report.find(:report)
+ end
+
+ it "should redirect :save to the indirection" do
+ Facter.stubs(:value).returns("eh")
+ @indirection = stub 'indirection', :name => :report
+ Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
+ report = Puppet::Transaction::Report.new
+ @indirection.expects(:save)
+ report.save
+ end
+
+ it "should default to the 'processor' terminus" do
+ Puppet::Transaction::Report.indirection.terminus_class.should == :processor
+ end
+
+ it "should delegate its name attribute to its host method" do
+ report = Puppet::Transaction::Report.new
+ report.expects(:host).returns "me"
+ report.name.should == "me"
+ end
+
+ after do
+ Puppet::Util::Cacher.expire
+ end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list