diff options
Diffstat (limited to 'spec/unit/indirector/indirection.rb')
| -rwxr-xr-x | spec/unit/indirector/indirection.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb index 455b5dc67..cb1b4b8e8 100755 --- a/spec/unit/indirector/indirection.rb +++ b/spec/unit/indirector/indirection.rb @@ -23,7 +23,7 @@ describe Puppet::Indirector::Indirection do @indirection.find(@name).should == @instance end - it "should handle removing model instances from a terminus letting the appropriate terminus remove the instance" do + it "should handle removing model instances from a terminus by letting the appropriate terminus remove the instance" do @terminus.expects(:destroy).with(@name).returns(@instance) @indirection.destroy(@name).should == @instance end @@ -103,11 +103,21 @@ describe Puppet::Indirector::Indirection, " when managing indirection instances" @indirection = Puppet::Indirector::Indirection.new(mock('model'), :test) Puppet::Indirector::Indirection.instance(:test).should equal(@indirection) end - + it "should return nil when the named indirection has not been created" do Puppet::Indirector::Indirection.instance(:test).should be_nil end + it "should allow an indirection's model to be retrieved by name" do + mock_model = mock('model') + @indirection = Puppet::Indirector::Indirection.new(mock_model, :test) + Puppet::Indirector::Indirection.model(:test).should equal(mock_model) + end + + it "should return nil when no model matches the requested name" do + Puppet::Indirector::Indirection.model(:test).should be_nil + end + after do @indirection.delete if defined? @indirection end |
