From 6996e0bbfb3559773e5fa0d133a7632dcb06b2d5 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 10 Jun 2011 14:03:47 -0700 Subject: Do not needlessly create multiple reports when creating a transaction Previously, the transaction would always create a report, which would some times be overridden with a new report. Now, the transaction optionally takes a report at initialization time, and only creates a report of its own if none was provided. Reviewed-by: Jacob Helwig --- spec/unit/transaction_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'spec/unit') diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index 862413a31..b5703e752 100755 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -88,13 +88,19 @@ describe Puppet::Transaction do @transaction.should_not be_any_failed end - it "should be possible to replace the report object" do + it "should use the provided report object" do report = Puppet::Transaction::Report.new("apply") - @transaction.report = report + @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new, report) @transaction.report.should == report end + it "should create a report if none is provided" do + @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new) + + @transaction.report.should be_kind_of Puppet::Transaction::Report + end + it "should consider a resource to have failed dependencies if any of its dependencies are failed" describe "when initializing" do -- cgit