summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector/report
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/indirector/report')
-rwxr-xr-xspec/unit/indirector/report/processor_spec.rb118
-rwxr-xr-xspec/unit/indirector/report/rest_spec.rb34
2 files changed, 76 insertions, 76 deletions
diff --git a/spec/unit/indirector/report/processor_spec.rb b/spec/unit/indirector/report/processor_spec.rb
index 3ee9b1b5e..5602a271f 100755
--- a/spec/unit/indirector/report/processor_spec.rb
+++ b/spec/unit/indirector/report/processor_spec.rb
@@ -8,74 +8,74 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/indirector/report/processor'
describe Puppet::Transaction::Report::Processor do
- before do
- Puppet.settings.stubs(:use).returns(true)
- end
+ before do
+ Puppet.settings.stubs(:use).returns(true)
+ end
- it "should provide a method for saving reports" do
- Puppet::Transaction::Report::Processor.new.should respond_to(:save)
- end
+ it "should provide a method for saving reports" do
+ Puppet::Transaction::Report::Processor.new.should respond_to(:save)
+ end
end
describe Puppet::Transaction::Report::Processor, " when saving a report" do
- before do
- Puppet.settings.stubs(:use)
- @reporter = Puppet::Transaction::Report::Processor.new
- end
+ before do
+ Puppet.settings.stubs(:use)
+ @reporter = Puppet::Transaction::Report::Processor.new
+ end
- it "should not process the report if reports are set to 'none'" do
- Puppet::Reports.expects(:report).never
- Puppet.settings.expects(:value).with(:reports).returns("none")
+ it "should not process the report if reports are set to 'none'" do
+ Puppet::Reports.expects(:report).never
+ Puppet.settings.expects(:value).with(:reports).returns("none")
- request = stub 'request', :instance => mock("report")
+ request = stub 'request', :instance => mock("report")
- @reporter.save(request)
- end
+ @reporter.save(request)
+ end
- it "should process the report with each configured report type" do
- Puppet.settings.stubs(:value).with(:reports).returns("one,two")
- @reporter.send(:reports).should == %w{one two}
- end
+ it "should process the report with each configured report type" do
+ Puppet.settings.stubs(:value).with(:reports).returns("one,two")
+ @reporter.send(:reports).should == %w{one two}
+ end
end
describe Puppet::Transaction::Report::Processor, " when processing a report" do
- before do
- Puppet.settings.stubs(:value).with(:reports).returns("one")
- Puppet.settings.stubs(:use)
- @reporter = Puppet::Transaction::Report::Processor.new
-
- @report_type = mock 'one'
- @dup_report = mock 'dupe report'
- @dup_report.stubs(:process)
- @report = mock 'report'
- @report.expects(:dup).returns(@dup_report)
-
- @request = stub 'request', :instance => @report
-
- Puppet::Reports.expects(:report).with("one").returns(@report_type)
-
- @dup_report.expects(:extend).with(@report_type)
- end
-
- # LAK:NOTE This is stupid, because the code is so short it doesn't
- # make sense to split it out, which means I just do the same test
- # three times so the spec looks right.
- it "should process a duplicate of the report, not the original" do
- @reporter.save(@request)
- end
-
- it "should extend the report with the report type's module" do
- @reporter.save(@request)
- end
-
- it "should call the report type's :process method" do
- @dup_report.expects(:process)
- @reporter.save(@request)
- end
-
- it "should not raise exceptions" do
- Puppet.settings.stubs(:value).with(:trace).returns(false)
- @dup_report.expects(:process).raises(ArgumentError)
- proc { @reporter.save(@request) }.should_not raise_error
- end
+ before do
+ Puppet.settings.stubs(:value).with(:reports).returns("one")
+ Puppet.settings.stubs(:use)
+ @reporter = Puppet::Transaction::Report::Processor.new
+
+ @report_type = mock 'one'
+ @dup_report = mock 'dupe report'
+ @dup_report.stubs(:process)
+ @report = mock 'report'
+ @report.expects(:dup).returns(@dup_report)
+
+ @request = stub 'request', :instance => @report
+
+ Puppet::Reports.expects(:report).with("one").returns(@report_type)
+
+ @dup_report.expects(:extend).with(@report_type)
+ end
+
+ # LAK:NOTE This is stupid, because the code is so short it doesn't
+ # make sense to split it out, which means I just do the same test
+ # three times so the spec looks right.
+ it "should process a duplicate of the report, not the original" do
+ @reporter.save(@request)
+ end
+
+ it "should extend the report with the report type's module" do
+ @reporter.save(@request)
+ end
+
+ it "should call the report type's :process method" do
+ @dup_report.expects(:process)
+ @reporter.save(@request)
+ end
+
+ it "should not raise exceptions" do
+ Puppet.settings.stubs(:value).with(:trace).returns(false)
+ @dup_report.expects(:process).raises(ArgumentError)
+ proc { @reporter.save(@request) }.should_not raise_error
+ end
end
diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb
index ce6188334..d0d29f862 100755
--- a/spec/unit/indirector/report/rest_spec.rb
+++ b/spec/unit/indirector/report/rest_spec.rb
@@ -5,24 +5,24 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/indirector/report/rest'
describe Puppet::Transaction::Report::Rest do
- it "should be a subclass of Puppet::Indirector::REST" do
- Puppet::Transaction::Report::Rest.superclass.should equal(Puppet::Indirector::REST)
- end
+ it "should be a subclass of Puppet::Indirector::REST" do
+ Puppet::Transaction::Report::Rest.superclass.should equal(Puppet::Indirector::REST)
+ end
- it "should use the :report_server setting in preference to :reportserver" do
- Puppet.settings[:reportserver] = "reportserver"
- Puppet.settings[:report_server] = "report_server"
- Puppet::Transaction::Report::Rest.server.should == "report_server"
- end
+ it "should use the :report_server setting in preference to :reportserver" do
+ Puppet.settings[:reportserver] = "reportserver"
+ Puppet.settings[:report_server] = "report_server"
+ Puppet::Transaction::Report::Rest.server.should == "report_server"
+ end
- it "should use the :report_server setting in preference to :server" do
- Puppet.settings[:server] = "server"
- Puppet.settings[:report_server] = "report_server"
- Puppet::Transaction::Report::Rest.server.should == "report_server"
- end
+ it "should use the :report_server setting in preference to :server" do
+ Puppet.settings[:server] = "server"
+ Puppet.settings[:report_server] = "report_server"
+ Puppet::Transaction::Report::Rest.server.should == "report_server"
+ end
- it "should have a value for report_server and report_port" do
- Puppet::Transaction::Report::Rest.server.should_not be_nil
- Puppet::Transaction::Report::Rest.port.should_not be_nil
- end
+ it "should have a value for report_server and report_port" do
+ Puppet::Transaction::Report::Rest.server.should_not be_nil
+ Puppet::Transaction::Report::Rest.port.should_not be_nil
+ end
end