summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xspec/integration/node/facts_spec.rb2
-rwxr-xr-xspec/integration/node_spec.rb8
-rwxr-xr-xspec/integration/ssl/certificate_request_spec.rb6
-rwxr-xr-xspec/integration/transaction/report_spec.rb2
-rwxr-xr-xspec/unit/application/kick_spec.rb2
-rwxr-xr-xspec/unit/application/queue_spec.rb4
-rwxr-xr-xspec/unit/configurer_spec.rb6
-rwxr-xr-xspec/unit/file_bucket/dipper_spec.rb21
-rw-r--r--spec/unit/file_bucket/file_spec.rb10
-rwxr-xr-xspec/unit/indirector/catalog/compiler_spec.rb4
-rwxr-xr-xspec/unit/indirector_spec.rb23
-rwxr-xr-xspec/unit/network/http/handler_spec.rb3
-rwxr-xr-xspec/unit/node/facts_spec.rb2
-rwxr-xr-xspec/unit/ssl/certificate_authority_spec.rb21
-rwxr-xr-xspec/unit/ssl/certificate_request_spec.rb11
-rwxr-xr-xspec/unit/ssl/certificate_revocation_list_spec.rb4
-rwxr-xr-xspec/unit/ssl/host_spec.rb21
-rwxr-xr-xspec/unit/transaction/report_spec.rb2
-rwxr-xr-xtest/network/handler/master.rb14
19 files changed, 72 insertions, 94 deletions
diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb
index 047d9d461..a555b2044 100755
--- a/spec/integration/node/facts_spec.rb
+++ b/spec/integration/node/facts_spec.rb
@@ -19,7 +19,7 @@ describe Puppet::Node::Facts do
Puppet::Node.indirection.expects(:expire).with("me")
facts = Puppet::Node::Facts.new("me")
- facts.save
+ Puppet::Node::Facts.indirection.save(facts)
end
it "should be able to delegate to the :yaml terminus" do
diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb
index 0d46259dd..911a423a0 100755
--- a/spec/integration/node_spec.rb
+++ b/spec/integration/node_spec.rb
@@ -68,19 +68,19 @@ describe Puppet::Node do
end
it "should be able to find nodes that were previously saved" do
- @node.save
+ Puppet::Node.indirection.save(@node)
Puppet::Node.indirection.find(@name).should equal(@node)
end
it "should replace existing saved nodes when a new node with the same name is saved" do
- @node.save
+ Puppet::Node.indirection.save(@node)
two = Puppet::Node.new(@name)
- two.save
+ Puppet::Node.indirection.save(two)
Puppet::Node.indirection.find(@name).should equal(two)
end
it "should be able to remove previously saved nodes" do
- @node.save
+ Puppet::Node.indirection.save(@node)
Puppet::Node.indirection.destroy(@node.name)
Puppet::Node.indirection.find(@name).should be_nil
end
diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb
index e04360548..d92346bb1 100755
--- a/spec/integration/ssl/certificate_request_spec.rb
+++ b/spec/integration/ssl/certificate_request_spec.rb
@@ -43,19 +43,19 @@ describe Puppet::SSL::CertificateRequest do
end
it "should be able to save CSRs" do
- @csr.save
+ Puppet::SSL::CertificateRequest.indirection.save(@csr)
end
it "should be able to find saved certificate requests via the Indirector" do
@csr.generate(@key)
- @csr.save
+ Puppet::SSL::CertificateRequest.indirection.save(@csr)
Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest)
end
it "should save the completely CSR when saving" do
@csr.generate(@key)
- @csr.save
+ Puppet::SSL::CertificateRequest.indirection.save(@csr)
Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").content.to_s.should == @csr.content.to_s
end
diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb
index eed7acaa9..2afd037c7 100755
--- a/spec/integration/transaction/report_spec.rb
+++ b/spec/integration/transaction/report_spec.rb
@@ -23,7 +23,7 @@ describe Puppet::Transaction::Report do
terminus.expects(:process).with(report)
- report.save
+ Puppet::Transaction::Report.indirection.save(report)
end
end
end
diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb
index 3a7106338..5ccf81bd0 100755
--- a/spec/unit/application/kick_spec.rb
+++ b/spec/unit/application/kick_spec.rb
@@ -279,7 +279,7 @@ describe Puppet::Application::Kick do
end
it "should call run on a Puppet::Run for the given host" do
- @agent_run.expects(:save).with('https://host:8139/production/run/host').returns(@agent_run)
+ Puppet::Run.indirection.expects(:save).with(@agent_run, 'https://host:8139/production/run/host').returns(@agent_run)
@kick.run_for_host('host')
end
diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb
index 18fd8cea2..619f94e45 100755
--- a/spec/unit/application/queue_spec.rb
+++ b/spec/unit/application/queue_spec.rb
@@ -171,8 +171,8 @@ describe Puppet::Application::Queue do
end
it "should log and save each catalog passed by the queue" do
- catalog = mock 'catalog', :name => 'eh'
- catalog.expects(:save)
+ catalog = Puppet::Resource::Catalog.new('eh')
+ Puppet::Resource::Catalog.indirection.expects(:save).with(catalog, nil)
Puppet::Resource::Catalog::Queue.expects(:subscribe).yields(catalog)
Puppet.expects(:notice).times(2)
diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb
index bb3a73994..0f65d1d5f 100755
--- a/spec/unit/configurer_spec.rb
+++ b/spec/unit/configurer_spec.rb
@@ -236,7 +236,7 @@ describe Puppet::Configurer, "when sending a report" do
@configurer = Puppet::Configurer.new
@configurer.stubs(:save_last_run_summary)
- @report = stub 'report'
+ @report = Puppet::Transaction::Report.new
@trans = stub 'transaction'
end
@@ -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
- @report.expects(:save)
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil)
@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
- @report.expects(:save).raises "whatever"
+ Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil).raises "whatever"
Puppet.expects(:err)
lambda { @configurer.send_report(@report) }.should_not raise_error
diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb
index 4897dc1f8..46d314d1f 100755
--- a/spec/unit/file_bucket/dipper_spec.rb
+++ b/spec/unit/file_bucket/dipper_spec.rb
@@ -16,10 +16,9 @@ describe Puppet::FileBucket::Dipper do
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket")
- filemock = stub "bucketfile"
- Puppet::FileBucket::File.stubs(:new).returns(filemock)
- filemock.expects(:name).returns "name"
- filemock.expects(:save).raises ArgumentError
+ Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!)
+ file = Puppet::FileBucket::File.new(nil)
+ Puppet::FileBucket::File.indirection.expects(:save).raises ArgumentError
lambda { @dipper.backup("/my/file") }.should raise_error(Puppet::Error)
end
@@ -32,10 +31,9 @@ describe Puppet::FileBucket::Dipper do
File.stubs(:exist?).returns true
File.stubs(:read).with("/my/file").returns "my contents"
- bucketfile = stub "bucketfile"
- bucketfile.stubs(:name).returns('md5/DIGEST123')
- bucketfile.stubs(:checksum_data).returns("DIGEST123")
- bucketfile.expects(:save).with('md5/DIGEST123')
+ Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!)
+ bucketfile = Puppet::FileBucket::File.new(nil, :checksum_type => "md5", :checksum => "{md5}DIGEST123")
+ Puppet::FileBucket::File.indirection.expects(:save).with(bucketfile, 'md5/DIGEST123')
Puppet::FileBucket::File.stubs(:new).with(
@@ -79,10 +77,9 @@ describe Puppet::FileBucket::Dipper do
File.stubs(:exist?).returns true
File.stubs(:read).with("/my/file").returns "my contents"
- bucketfile = stub "bucketfile"
- bucketfile.stubs(:name).returns('md5/DIGEST123')
- bucketfile.stubs(:checksum_data).returns("DIGEST123")
- bucketfile.expects(:save).with('https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123')
+ Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!)
+ bucketfile = Puppet::FileBucket::File.new(nil, :checksum_type => "md5", :checksum => "{md5}DIGEST123")
+ Puppet::FileBucket::File.indirection.expects(:save).with(bucketfile, 'https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123')
Puppet::FileBucket::File.stubs(:new).with(
diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb
index 42ed94253..b9849b0fc 100644
--- a/spec/unit/file_bucket/file_spec.rb
+++ b/spec/unit/file_bucket/file_spec.rb
@@ -95,7 +95,7 @@ describe Puppet::FileBucket::File do
end
it "should have a :save instance method" do
- Puppet::FileBucket::File.new("mysum").should respond_to(:save)
+ Puppet::FileBucket::File.indirection.should respond_to(:save)
end
end
@@ -108,7 +108,7 @@ describe Puppet::FileBucket::File do
mockfile.expects(:print).with(@contents)
::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440).yields(mockfile)
- Puppet::FileBucket::File.new(@contents).save
+ Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents))
end
it "should make any directories necessary for storage" do
@@ -119,7 +119,7 @@ describe Puppet::FileBucket::File do
::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440)
::File.expects(:exist?).with("#{@dir}/contents").returns false
- Puppet::FileBucket::File.new(@contents).save
+ Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents))
end
it "should append the path to the paths file" do
@@ -133,7 +133,7 @@ describe Puppet::FileBucket::File do
mockfile.expects(:puts).with('/path/on/the/remote/box')
::File.expects(:exist?).with("#{@dir}/paths").returns false
::File.expects(:open).with("#{@dir}/paths", ::File::WRONLY|::File::CREAT|::File::APPEND).yields mockfile
- Puppet::FileBucket::File.new(@contents, :path => remote_path).save
+ Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents, :path => remote_path))
end
end
@@ -179,7 +179,7 @@ describe Puppet::FileBucket::File do
::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440)
bucketfile = Puppet::FileBucket::File.new(@contents)
- bucketfile.save
+ Puppet::FileBucket::File.indirection.save(bucketfile)
end
diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb
index 264af2635..c58fbbd50 100755
--- a/spec/unit/indirector/catalog/compiler_spec.rb
+++ b/spec/unit/indirector/catalog/compiler_spec.rb
@@ -158,7 +158,7 @@ describe Puppet::Resource::Catalog::Compiler do
@request = stub 'request', :options => {}
@facts = Puppet::Node::Facts.new('hostname', "fact" => "value", "architecture" => "i386")
- @facts.stubs(:save).returns(nil)
+ Puppet::Node::Facts.indirection.stubs(:save).returns(nil)
end
it "should do nothing if no facts are provided" do
@@ -194,7 +194,7 @@ describe Puppet::Resource::Catalog::Compiler do
@request.options[:facts] = "bar"
Puppet::Node::Facts.expects(:convert_from).returns @facts
- @facts.expects(:save)
+ Puppet::Node::Facts.indirection.expects(:save).with(@facts, nil)
@compiler.extract_facts_from_request(@request)
end
diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb
index 119a52eec..7c193a9aa 100755
--- a/spec/unit/indirector_spec.rb
+++ b/spec/unit/indirector_spec.rb
@@ -80,29 +80,6 @@ describe Puppet::Indirector, "when redirecting a model" do
@thingie.ancestors.should be_include(Puppet::Indirector::Envelope)
end
- # This is an instance method, so it behaves a bit differently.
- describe "when saving instances via the model" do
- before do
- @instance = @thingie.new("me")
- end
-
- it "should delegate to the indirection" do
- @indirection.expects(:save)
- @instance.save
- end
-
- it "should pass the instance and an optional key to the indirection's :save method" do
- @indirection.expects(:save).with(@instance, "key")
- @instance.save "key"
- end
-
- it "should return the results of the delegation as its result" do
- request = mock 'request'
- @indirection.expects(:save).returns "yay"
- @instance.save.should == "yay"
- end
- end
-
after do
@indirection.delete
end
diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb
index 9dddc9962..8f9388aaf 100755
--- a/spec/unit/network/http/handler_spec.rb
+++ b/spec/unit/network/http/handler_spec.rb
@@ -352,8 +352,9 @@ describe Puppet::Network::HTTP::Handler do
@result = stub 'result', :render => "the result"
- @model_instance = stub('indirected model instance', :save => true)
+ @model_instance = stub('indirected model instance')
@model_class.stubs(:convert_from).returns(@model_instance)
+ @model_instance.stubs(:save)
@format = stub 'format', :suitable? => true, :name => "format", :mime => "text/format"
Puppet::Network::FormatHandler.stubs(:format).returns @format
diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb
index 7873b415d..de2cd554f 100755
--- a/spec/unit/node/facts_spec.rb
+++ b/spec/unit/node/facts_spec.rb
@@ -79,7 +79,7 @@ describe Puppet::Node::Facts, "when indirecting" do
it "should redirect to the specified fact store for storage" do
Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
@indirection.expects(:save)
- @facts.save
+ Puppet::Node::Facts.indirection.save(@facts)
end
describe "when the Puppet application is 'master'" do
diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb
index 2219aa99d..a350c0fe3 100755
--- a/spec/unit/ssl/certificate_authority_spec.rb
+++ b/spec/unit/ssl/certificate_authority_spec.rb
@@ -143,13 +143,13 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should create, generate, and save a new CRL instance of no CRL can be found" do
- crl = mock 'crl'
+ crl = Puppet::SSL::CertificateRevocationList.new("fakename")
Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns nil
Puppet::SSL::CertificateRevocationList.expects(:new).returns crl
crl.expects(:generate).with(@ca.host.certificate.content, @ca.host.key.content)
- crl.expects(:save)
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl, nil)
@ca.crl.should equal(crl)
end
@@ -235,12 +235,13 @@ describe Puppet::SSL::CertificateAuthority do
@name = "myhost"
@real_cert = stub 'realcert', :sign => nil
- @cert = stub 'certificate', :content => @real_cert
+ @cert = Puppet::SSL::Certificate.new(@name)
+ @cert.content = @real_cert
Puppet::SSL::Certificate.stubs(:new).returns @cert
@cert.stubs(:content=)
- @cert.stubs(:save)
+ Puppet::SSL::Certificate.indirection.stubs(:save)
# Stub out the factory
@factory = stub 'factory', :result => "my real cert"
@@ -329,7 +330,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should save the resulting certificate" do
- @cert.expects(:save)
+ Puppet::SSL::Certificate.indirection.expects(:save).with(@cert, nil)
@ca.sign(@name, :ca, @request)
end
@@ -341,7 +342,7 @@ describe Puppet::SSL::CertificateAuthority do
@ca.stubs(:next_serial).returns @serial
Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
- @cert.stubs :save
+ Puppet::SSL::CertificateRequest.indirection.stubs :save
end
it "should use a certificate type of :server" do
@@ -390,7 +391,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should save the resulting certificate" do
- @cert.expects(:save)
+ Puppet::SSL::Certificate.indirection.stubs(:save).with(@cert)
@ca.sign(@name)
end
@@ -406,7 +407,7 @@ describe Puppet::SSL::CertificateAuthority do
@ca.stubs(:next_serial).returns @serial
Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
- @cert.stubs :save
+ Puppet::SSL::Certificate.indirection.stubs :save
Puppet::SSL::Certificate.expects(:new).with(@name).returns @cert
@ca.sign(@name)
@@ -415,7 +416,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should return the certificate instance" do
@ca.stubs(:next_serial).returns @serial
Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
- @cert.stubs :save
+ Puppet::SSL::Certificate.indirection.stubs :save
@ca.sign(@name).should equal(@cert)
end
@@ -424,7 +425,7 @@ describe Puppet::SSL::CertificateAuthority do
@inventory.expects(:add).with(@cert)
Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
- @cert.stubs :save
+ Puppet::SSL::Certificate.indirection.stubs :save
@ca.sign(@name)
end
diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb
index 25b77b332..fb4b5a134 100755
--- a/spec/unit/ssl/certificate_request_spec.rb
+++ b/spec/unit/ssl/certificate_request_spec.rb
@@ -187,13 +187,6 @@ describe Puppet::SSL::CertificateRequest do
end
describe "when a CSR is saved" do
- it "should allow arguments" do
- csr = Puppet::SSL::CertificateRequest.new("me")
- csr.class.indirection.stubs(:save)
-
- lambda { csr.save :ipaddress => "foo" }.should_not raise_error
- end
-
describe "and a CA is available" do
it "should save the CSR and trigger autosigning" do
ca = mock 'ca', :autosign
@@ -204,7 +197,7 @@ describe Puppet::SSL::CertificateRequest do
Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" }
- csr.save
+ Puppet::SSL::CertificateRequest.indirection.save(csr)
end
end
@@ -217,7 +210,7 @@ describe Puppet::SSL::CertificateRequest do
Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" }
- csr.save
+ Puppet::SSL::CertificateRequest.indirection.save(csr)
end
end
end
diff --git a/spec/unit/ssl/certificate_revocation_list_spec.rb b/spec/unit/ssl/certificate_revocation_list_spec.rb
index f9993d52e..3bf12fa0a 100755
--- a/spec/unit/ssl/certificate_revocation_list_spec.rb
+++ b/spec/unit/ssl/certificate_revocation_list_spec.rb
@@ -119,7 +119,7 @@ describe Puppet::SSL::CertificateRevocationList do
@crl.generate(@cert, @key)
@crl.content.stubs(:sign)
- @crl.stubs :save
+ Puppet::SSL::CertificateRevocationList.indirection.stubs :save
@key = mock 'key'
end
@@ -161,7 +161,7 @@ describe Puppet::SSL::CertificateRevocationList do
end
it "should save the CRL" do
- @crl.expects :save
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(@crl, nil)
@crl.revoke(1, @key)
end
end
diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb
index 3b7ed18e1..05239431c 100755
--- a/spec/unit/ssl/host_spec.rb
+++ b/spec/unit/ssl/host_spec.rb
@@ -301,7 +301,8 @@ describe Puppet::SSL::Host do
describe "when managing its private key" do
before do
@realkey = "mykey"
- @key = stub 'key', :content => @realkey
+ @key = Puppet::SSL::Key.new("mykey")
+ @key.content = @realkey
end
it "should return nil if the key is not set and cannot be found" do
@@ -318,7 +319,7 @@ describe Puppet::SSL::Host do
Puppet::SSL::Key.expects(:new).with("myname").returns(@key)
@key.expects(:generate)
- @key.expects(:save)
+ Puppet::SSL::Key.indirection.expects(:save)
@host.generate_key.should be_true
@host.key.should equal(@key)
@@ -328,7 +329,7 @@ describe Puppet::SSL::Host do
Puppet::SSL::Key.expects(:new).with("myname").returns(@key)
@key.stubs(:generate)
- @key.expects(:save).raises "eh"
+ Puppet::SSL::Key.indirection.expects(:save).raises "eh"
lambda { @host.generate_key }.should raise_error
@host.key.should be_nil
@@ -344,7 +345,8 @@ describe Puppet::SSL::Host do
describe "when managing its certificate request" do
before do
@realrequest = "real request"
- @request = stub 'request', :content => @realrequest
+ @request = Puppet::SSL::CertificateRequest.new("myname")
+ @request.content = @realrequest
end
it "should return nil if the key is not set and cannot be found" do
@@ -367,7 +369,7 @@ describe Puppet::SSL::Host do
@host.expects(:generate_key).returns(key)
@request.stubs(:generate)
- @request.stubs(:save)
+ Puppet::SSL::CertificateRequest.indirection.stubs(:save)
@host.generate_certificate_request
end
@@ -378,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")
- @request.expects(:save)
+ Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request, nil)
@host.generate_certificate_request.should be_true
@host.certificate_request.should equal(@request)
@@ -397,11 +399,14 @@ describe Puppet::SSL::Host do
key = stub 'key', :public_key => mock("public_key"), :content => "mycontent"
@host.stubs(:key).returns(key)
@request.stubs(:generate)
- @request.expects(:save).raises "eh"
+ @request.stubs(:name).returns("myname")
+ terminus = stub 'terminus'
+ Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
+ terminus.expects(:save).with { |req| req.instance == @request && req.key == "myname" }.raises "eh"
lambda { @host.generate_certificate_request }.should raise_error
- @host.certificate_request.should be_nil
+ @host.instance_eval { @certificate_request }.should be_nil
end
end
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb
index 4dd104c74..1f1fdb080 100755
--- a/spec/unit/transaction/report_spec.rb
+++ b/spec/unit/transaction/report_spec.rb
@@ -59,7 +59,7 @@ describe Puppet::Transaction::Report do
Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
report = Puppet::Transaction::Report.new
@indirection.expects(:save)
- report.save
+ Puppet::Transaction::Report.indirection.save(report)
end
it "should default to the 'processor' terminus" do
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb
index 018f6904b..56d1991d5 100755
--- a/test/network/handler/master.rb
+++ b/test/network/handler/master.rb
@@ -32,15 +32,17 @@ class TestMaster < Test::Unit::TestCase
def test_hostname_is_used_if_client_is_missing
@master.expects(:decode_facts).returns("hostname" => "yay")
- Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(stub('facts', :save => nil))
+ facts = Puppet::Node::Facts.new("the_facts")
+ Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil)
+ Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(facts)
@master.getconfig("facts")
end
def test_facts_are_saved
- facts = mock('facts')
+ facts = Puppet::Node::Facts.new("the_facts")
Puppet::Node::Facts.expects(:new).returns(facts)
- facts.expects(:save)
+ Puppet::Node::Facts.indirection.expects(:save).with(facts, nil)
@master.stubs(:decode_facts)
@@ -48,7 +50,8 @@ class TestMaster < Test::Unit::TestCase
end
def test_catalog_is_used_for_compiling
- facts = stub('facts', :save => nil)
+ facts = Puppet::Node::Facts.new("the_facts")
+ Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil)
Puppet::Node::Facts.stubs(:new).returns(facts)
@master.stubs(:decode_facts)
@@ -61,8 +64,9 @@ end
class TestMasterFormats < Test::Unit::TestCase
def setup
- @facts = stub('facts', :save => nil)
+ @facts = Puppet::Node::Facts.new("the_facts")
Puppet::Node::Facts.stubs(:new).returns(@facts)
+ Puppet::Node::Facts.indirection.stubs(:save)
@master = Puppet::Network::Handler.master.new(:Code => "")
@master.stubs(:decode_facts)