summaryrefslogtreecommitdiffstats
path: root/spec/unit/configurer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/configurer_spec.rb')
-rwxr-xr-xspec/unit/configurer_spec.rb50
1 files changed, 21 insertions, 29 deletions
diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb
index 72754f398..3b2a44f0f 100755
--- a/spec/unit/configurer_spec.rb
+++ b/spec/unit/configurer_spec.rb
@@ -72,14 +72,6 @@ describe Puppet::Configurer do
end
end
-describe Puppet::Configurer, "when initializing a report" do
- it "should return an instance of a transaction report" do
- Puppet.settings.stubs(:use).returns(true)
- @agent = Puppet::Configurer.new
- @agent.initialize_report.should be_instance_of(Puppet::Transaction::Report)
- end
-end
-
describe Puppet::Configurer, "when executing a catalog run" do
before do
Puppet.settings.stubs(:use).returns(true)
@@ -101,31 +93,31 @@ describe Puppet::Configurer, "when executing a catalog run" do
end
it "should initialize a transaction report if one is not provided" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns report
@agent.run
end
it "should pass the new report to the catalog" do
- report = stub 'report'
- @agent.stubs(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.stubs(:new).returns report
@catalog.expects(:apply).with{|options| options[:report] == report}
@agent.run
end
it "should use the provided report if it was passed one" do
- report = stub 'report'
- @agent.expects(:initialize_report).never
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).never
@catalog.expects(:apply).with{|options| options[:report] == report}
@agent.run(:report => report)
end
it "should set the report as a log destination" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns report
Puppet::Util::Log.expects(:newdestination).with(report)
@@ -176,16 +168,16 @@ describe Puppet::Configurer, "when executing a catalog run" do
end
it "should send the report" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
@agent.expects(:send_report).with { |r, trans| r == report }
@agent.run
end
it "should send the transaction report with a reference to the transaction if a run was actually made" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
trans = stub 'transaction'
@catalog.expects(:apply).returns trans
@@ -198,8 +190,8 @@ describe Puppet::Configurer, "when executing a catalog run" do
it "should send the transaction report even if the catalog could not be retrieved" do
@agent.expects(:retrieve_catalog).returns nil
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
@agent.expects(:send_report)
@agent.run
@@ -208,16 +200,16 @@ describe Puppet::Configurer, "when executing a catalog run" do
it "should send the transaction report even if there is a failure" do
@agent.expects(:retrieve_catalog).raises "whatever"
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
@agent.expects(:send_report)
lambda { @agent.run }.should raise_error
end
it "should remove the report as a log destination when the run is finished" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
Puppet::Util::Log.expects(:close).with(report)
@@ -225,8 +217,8 @@ describe Puppet::Configurer, "when executing a catalog run" do
end
it "should return the report as the result of the run" do
- report = stub 'report'
- @agent.expects(:initialize_report).returns report
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.expects(:new).returns(report)
@agent.run.should equal(report)
end
@@ -237,7 +229,7 @@ describe Puppet::Configurer, "when sending a report" do
Puppet.settings.stubs(:use).returns(true)
@configurer = Puppet::Configurer.new
- @report = stub 'report'
+ @report = Puppet::Transaction::Report.new("apply")
@trans = stub 'transaction'
end