summaryrefslogtreecommitdiffstats
path: root/spec/unit/node
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/node')
-rwxr-xr-xspec/unit/node/configuration.rb24
-rwxr-xr-xspec/unit/node/facts.rb15
2 files changed, 34 insertions, 5 deletions
diff --git a/spec/unit/node/configuration.rb b/spec/unit/node/configuration.rb
index 6b0677973..c94f31380 100755
--- a/spec/unit/node/configuration.rb
+++ b/spec/unit/node/configuration.rb
@@ -490,3 +490,27 @@ describe Puppet::Node::Configuration, " when writing dot files" do
Puppet.settings.clear
end
end
+
+describe Puppet::Node::Configuration, " when indirecting" do
+ before do
+ @indirection = mock 'indirection'
+
+ Puppet::Indirector::Indirection.clear_cache
+ @configuration = Puppet::Node::Facts.new("me")
+ end
+
+ it "should redirect to the indirection for retrieval" do
+ Puppet::Node::Configuration.stubs(:indirection).returns(@indirection)
+ @indirection.expects(:find).with(:myconfig)
+ Puppet::Node::Configuration.find(:myconfig)
+ end
+
+ it "should default to the code terminus" do
+ Puppet::Node::Configuration.indirection.terminus_class.should == :code
+ end
+
+ after do
+ mocha_verify
+ Puppet::Indirector::Indirection.clear_cache
+ end
+end
diff --git a/spec/unit/node/facts.rb b/spec/unit/node/facts.rb
index 61f05a2b2..ef5c91071 100755
--- a/spec/unit/node/facts.rb
+++ b/spec/unit/node/facts.rb
@@ -6,25 +6,30 @@ require 'puppet/node/facts'
describe Puppet::Node::Facts, " when indirecting" do
before do
- @terminus = mock 'terminus'
- Puppet::Node::Facts.stubs(:indirection).returns(@terminus)
+ @indirection = mock 'indirection'
- # We have to clear the cache so that the facts ask for our terminus stub,
+ # We have to clear the cache so that the facts ask for our indirection stub,
# instead of anything that might be cached.
Puppet::Indirector::Indirection.clear_cache
@facts = Puppet::Node::Facts.new("me", "one" => "two")
end
it "should redirect to the specified fact store for retrieval" do
- @terminus.expects(:find).with(:my_facts)
+ Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
+ @indirection.expects(:find).with(:my_facts)
Puppet::Node::Facts.find(:my_facts)
end
it "should redirect to the specified fact store for storage" do
- @terminus.expects(:save).with(@facts)
+ Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
+ @indirection.expects(:save).with(@facts)
@facts.save
end
+ it "should default to the code terminus" do
+ Puppet::Node::Facts.indirection.terminus_class.should == :code
+ end
+
after do
mocha_verify
Puppet::Indirector::Indirection.clear_cache