From 7e2ff4b39404ad9b0bdbc40d92c80bcb8c76fcf6 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 21 Sep 2007 13:18:51 -0500 Subject: 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. --- lib/puppet/indirector.rb | 2 -- 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 -- cgit