summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-21 13:18:51 -0500
committerLuke Kanies <luke@madstop.com>2007-09-21 13:18:51 -0500
commit7e2ff4b39404ad9b0bdbc40d92c80bcb8c76fcf6 (patch)
tree25767ebbea5aa5b1a46f3d366c8b2d815a016774
parent7740cd497f936859fa5213c34dae485b5b70ba60 (diff)
downloadpuppet-7e2ff4b39404ad9b0bdbc40d92c80bcb8c76fcf6.tar.gz
puppet-7e2ff4b39404ad9b0bdbc40d92c80bcb8c76fcf6.tar.xz
puppet-7e2ff4b39404ad9b0bdbc40d92c80bcb8c76fcf6.zip
Adding a couple more tests to the indirector, talking about
terminus registration. I am about to change how loading is handled, so that individual termini are declared as normal Ruby classes.
-rw-r--r--lib/puppet/indirector.rb2
-rwxr-xr-xspec/unit/indirector/indirector.rb13
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb
index 90f4d3d33..bb7006431 100644
--- a/lib/puppet/indirector.rb
+++ b/lib/puppet/indirector.rb
@@ -39,8 +39,6 @@ module Puppet::Indirector
# does all of the rest -- loading, storing, and retrieving by name.
require 'puppet/util/instance_loader'
extend Puppet::Util::InstanceLoader
-
-# JRB:TODO - where did this come from, re: the specs? also, shouldn't this be protected/private?
# Register a given indirection type. The classes including this module
# handle creating terminus instances, but the module itself handles
diff --git a/spec/unit/indirector/indirector.rb b/spec/unit/indirector/indirector.rb
index 2e22090b0..23637ec7c 100755
--- a/spec/unit/indirector/indirector.rb
+++ b/spec/unit/indirector/indirector.rb
@@ -36,6 +36,11 @@ describe Puppet::Indirector, "when registering an indirection" do
Proc.new { @thingie.indirects :second }.should raise_error(ArgumentError)
end
+ it "should set up instance loading for the indirection" do
+ Puppet::Indirector.expects(:instance_load).with(:test, "puppet/indirector/test")
+ @indirection = @thingie.indirects(:test)
+ end
+
after do
@indirection.delete if @indirection
end
@@ -79,6 +84,14 @@ describe Puppet::Indirector, " when redirecting model" do
end
end
+describe Puppet::Indirector, " when retrieving terminus classes" do
+ it "should allow terminus classes to register themselves"
+
+ it "should provide a method to retrieve a terminus class by name and indirection" do
+ Puppet::Indirector.expects(:loaded_instance).with(:indirection, :terminus)
+ Puppet::Indirector.terminus(:indirection, :terminus)
+ end
+end
# describe Puppet::Indirector::Terminus do