summaryrefslogtreecommitdiffstats
path: root/spec/unit/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-08 18:21:18 -0500
committerLuke Kanies <luke@madstop.com>2008-04-08 18:21:18 -0500
commitbf728d23caca4f58ae4ede1a2d477c9fc15e0bdc (patch)
treed79ae6e23667f0a1b201537914a025c9f677aa74 /spec/unit/node
parent644d6baae132a097170631f90521e878e31a5a0a (diff)
downloadpuppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.tar.gz
puppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.tar.xz
puppet-bf728d23caca4f58ae4ede1a2d477c9fc15e0bdc.zip
Intermediate commit.
This commit adds a Request instance into the indirection, pushing it all the way to the terminus instances. It's a big commit because it requires modifying every terminus class. There are still some thorny design issues. In particular, who should be responsible for making the request object? I've tried having both the indirection class and the Indirector module creating it, and both have their issues. Also, the Catalog class previously allowed passing Node instances directly to the find method, which is now no longer possible because the Request class would treat the node as the instance being found. We need the request class to have two modes, one when it's passed an instance and one when it's passed a key.
Diffstat (limited to 'spec/unit/node')
-rwxr-xr-xspec/unit/node/catalog.rb4
-rwxr-xr-xspec/unit/node/facts.rb6
2 files changed, 5 insertions, 5 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index 360dd87f2..cd27b925b 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -777,14 +777,14 @@ end
describe Puppet::Node::Catalog, " when indirecting" do
before do
- @indirection = mock 'indirection'
+ @indirection = stub 'indirection', :name => :catalog
Puppet::Indirector::Indirection.clear_cache
end
it "should redirect to the indirection for retrieval" do
Puppet::Node::Catalog.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find).with(:myconfig)
+ @indirection.expects(:find)
Puppet::Node::Catalog.find(:myconfig)
end
diff --git a/spec/unit/node/facts.rb b/spec/unit/node/facts.rb
index 743a7082e..1bfccd32e 100755
--- a/spec/unit/node/facts.rb
+++ b/spec/unit/node/facts.rb
@@ -6,7 +6,7 @@ require 'puppet/node/facts'
describe Puppet::Node::Facts, " when indirecting" do
before do
- @indirection = mock 'indirection'
+ @indirection = stub 'indirection', :request => mock('request'), :name => :facts
# We have to clear the cache so that the facts ask for our indirection stub,
# instead of anything that might be cached.
@@ -16,13 +16,13 @@ describe Puppet::Node::Facts, " when indirecting" do
it "should redirect to the specified fact store for retrieval" do
Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find).with(:my_facts)
+ @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).with(@facts)
+ @indirection.expects(:save)
@facts.save
end