From 14f8160674628340ccfd79baeb84f66cf1e0398a Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 29 Nov 2010 11:55:00 -0800 Subject: Maint: Refactor tests to use .indirection. Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. This change affects tests only. --- spec/unit/node/facts_spec.rb | 6 ------ 1 file changed, 6 deletions(-) (limited to 'spec/unit/node') diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index cb2aa3dc7..7873b415d 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -76,12 +76,6 @@ describe Puppet::Node::Facts, "when indirecting" do @facts = Puppet::Node::Facts.new("me", "one" => "two") end - it "should redirect to the specified fact store for retrieval" do - Puppet::Node::Facts.stubs(:indirection).returns(@indirection) - @indirection.expects(:find) - Puppet::Node::Facts.find(:my_facts) - end - it "should redirect to the specified fact store for storage" do Puppet::Node::Facts.stubs(:indirection).returns(@indirection) @indirection.expects(:save) -- cgit From f77764de3ace7cc880a77466618a5affe1b61a8e Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 12:06:33 -0800 Subject: Maint: Modified tests of indirector.save to call the indirection directly. This change replaces calls to .save with calls to .indirection.save(). 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 tests only; the next patch will make the corresponding change to the code. --- spec/unit/node/facts_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/unit/node') 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 -- cgit From 626d7564467bdc0e9d2d385e9aa10c539d9ed175 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 6 Dec 2010 12:01:18 -0800 Subject: maint: Use expand_path when requiring spec_helper or puppettest Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe --- spec/unit/node/environment_spec.rb | 2 +- spec/unit/node/facts_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/unit/node') diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index be2980879..153be5f60 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/node/environment' require 'puppet/util/execution' diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index de2cd554f..797009ae4 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/node/facts' -- cgit