summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-11-30 12:06:52 -0800
committerPaul Berry <paul@puppetlabs.com>2010-11-30 14:39:39 -0800
commit0747b58bfef9c6bb5f1f9ac1eb6a7b3955dac2af (patch)
tree2d7273c61a3aa21d4e475f63952450a0376a6b86 /spec
parentf77764de3ace7cc880a77466618a5affe1b61a8e (diff)
Maint: Modified uses of indirector.save to call the indirection directly.
This change replaces calls to <model object>.save with calls to <model class>.indirection.save(<model object>). This makes the use of the indirector explicit rather than implicit so that it will be easier to search for all indirector call sites using grep. This is an intermediate refactor on the way towards allowing indirector calls to be explicitly routed to multiple termini. This patch affects production code.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/application/queue_spec.rb2
-rwxr-xr-xspec/unit/application/resource_spec.rb4
-rwxr-xr-xspec/unit/configurer_spec.rb4
-rwxr-xr-xspec/unit/indirector/catalog/compiler_spec.rb2
-rwxr-xr-xspec/unit/network/http/handler_spec.rb6
-rwxr-xr-xspec/unit/ssl/certificate_authority_spec.rb4
-rwxr-xr-xspec/unit/ssl/host_spec.rb2
7 files changed, 12 insertions, 12 deletions
diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb
index 619f94e45..1c65b558c 100755
--- a/spec/unit/application/queue_spec.rb
+++ b/spec/unit/application/queue_spec.rb
@@ -172,7 +172,7 @@ describe Puppet::Application::Queue do
it "should log and save each catalog passed by the queue" do
catalog = Puppet::Resource::Catalog.new('eh')
- Puppet::Resource::Catalog.indirection.expects(:save).with(catalog, nil)
+ Puppet::Resource::Catalog.indirection.expects(:save).with(catalog)
Puppet::Resource::Catalog::Queue.expects(:subscribe).yields(catalog)
Puppet.expects(:notice).times(2)
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index 6ab99945c..df479ac89 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -184,7 +184,7 @@ describe Puppet::Application::Resource do
@resource.command_line.stubs(:args).returns(['type','name','param=temp'])
res = stub "resource"
- res.expects(:save).with('https://host:8139/production/resources/type/name').returns(res)
+ Puppet::Resource.indirection.expects(:save).with(res, 'https://host:8139/production/resources/type/name').returns(res)
res.expects(:collect)
res.expects(:to_manifest)
Puppet::Resource.expects(:new).with('type', 'name', :parameters => {'param' => 'temp'}).returns(res)
@@ -220,7 +220,7 @@ describe Puppet::Application::Resource do
@resource.command_line.stubs(:args).returns(['type','name','param=temp'])
res = stub "resource"
- res.expects(:save).with('type/name').returns(res)
+ Puppet::Resource.indirection.expects(:save).with(res, 'type/name').returns(res)
res.expects(:collect)
res.expects(:to_manifest)
Puppet::Resource.expects(:new).with('type', 'name', :parameters => {'param' => 'temp'}).returns(res)
diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb
index 0f65d1d5f..fc718fa58 100755
--- a/spec/unit/configurer_spec.rb
+++ b/spec/unit/configurer_spec.rb
@@ -272,7 +272,7 @@ describe Puppet::Configurer, "when sending a report" do
it "should save the report if reporting is enabled" do
Puppet.settings[:report] = true
- Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil)
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report)
@configurer.send_report(@report)
end
@@ -300,7 +300,7 @@ describe Puppet::Configurer, "when sending a report" do
it "should log but not fail if saving the report fails" do
Puppet.settings[:report] = true
- Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil).raises "whatever"
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report).raises "whatever"
Puppet.expects(:err)
lambda { @configurer.send_report(@report) }.should_not raise_error
diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb
index c58fbbd50..c8c53aecc 100755
--- a/spec/unit/indirector/catalog/compiler_spec.rb
+++ b/spec/unit/indirector/catalog/compiler_spec.rb
@@ -194,7 +194,7 @@ describe Puppet::Resource::Catalog::Compiler do
@request.options[:facts] = "bar"
Puppet::Node::Facts.expects(:convert_from).returns @facts
- Puppet::Node::Facts.indirection.expects(:save).with(@facts, nil)
+ Puppet::Node::Facts.indirection.expects(:save).with(@facts)
@compiler.extract_facts_from_request(@request)
end
diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb
index 8f9388aaf..e14b5739d 100755
--- a/spec/unit/network/http/handler_spec.rb
+++ b/spec/unit/network/http/handler_spec.rb
@@ -354,7 +354,7 @@ describe Puppet::Network::HTTP::Handler do
@model_instance = stub('indirected model instance')
@model_class.stubs(:convert_from).returns(@model_instance)
- @model_instance.stubs(:save)
+ @indirection.stubs(:save)
@format = stub 'format', :suitable? => true, :name => "format", :mime => "text/format"
Puppet::Network::FormatHandler.stubs(:format).returns @format
@@ -380,7 +380,7 @@ describe Puppet::Network::HTTP::Handler do
end
it "should use a common method for determining the request parameters" do
- @model_instance.expects(:save).with('key').once
+ @indirection.expects(:save).with(@model_instance, 'key').once
@handler.do_save("my_handler", "key", {}, @request, @response)
end
@@ -390,7 +390,7 @@ describe Puppet::Network::HTTP::Handler do
end
it "should return the yaml-serialized result when a model save call succeeds" do
- @model_instance.stubs(:save).returns(@model_instance)
+ @indirection.stubs(:save).returns(@model_instance)
@model_instance.expects(:to_yaml).returns('foo')
@handler.do_save("my_handler", "my_result", {}, @request, @response)
end
diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb
index a350c0fe3..7198e33ad 100755
--- a/spec/unit/ssl/certificate_authority_spec.rb
+++ b/spec/unit/ssl/certificate_authority_spec.rb
@@ -149,7 +149,7 @@ describe Puppet::SSL::CertificateAuthority do
Puppet::SSL::CertificateRevocationList.expects(:new).returns crl
crl.expects(:generate).with(@ca.host.certificate.content, @ca.host.key.content)
- Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl, nil)
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl)
@ca.crl.should equal(crl)
end
@@ -330,7 +330,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should save the resulting certificate" do
- Puppet::SSL::Certificate.indirection.expects(:save).with(@cert, nil)
+ Puppet::SSL::Certificate.indirection.expects(:save).with(@cert)
@ca.sign(@name, :ca, @request)
end
diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb
index 05239431c..77911091e 100755
--- a/spec/unit/ssl/host_spec.rb
+++ b/spec/unit/ssl/host_spec.rb
@@ -380,7 +380,7 @@ describe Puppet::SSL::Host do
key = stub 'key', :public_key => mock("public_key"), :content => "mycontent"
@host.stubs(:key).returns(key)
@request.expects(:generate).with("mycontent")
- Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request, nil)
+ Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request)
@host.generate_certificate_request.should be_true
@host.certificate_request.should equal(@request)