diff options
| -rw-r--r-- | lib/puppet/indirector.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/indirector/indirector.rb | 13 |
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 |
