From 125851278d745e443c0598fbb0577b010f824365 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 25 Feb 2008 19:40:44 -0500 Subject: Fixing #1084 -- the node catalog asks the individual resources whether they're isomorphic, and they in turn ask the resource types (or default to true for defined resource types). --- spec/unit/node/catalog.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/unit/node') diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index b1bf5abaa..604dabbb6 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -476,17 +476,19 @@ describe Puppet::Node::Catalog, " when functioning as a resource container" do it "should add an alias for the namevar when the title and name differ on isomorphic resource types" do resource = Puppet::Type.type(:file).create :path => "/something", :title => "other", :content => "blah" + resource.expects(:isomorphic?).returns(true) @catalog.add_resource(resource) @catalog.resource(:file, "other").should equal(resource) @catalog.resource(:file, "/something").ref.should == resource.ref end it "should not add an alias for the namevar when the title and name differ on non-isomorphic resource types" do - resource = Puppet::Type.type(:exec).create :command => "/bin/true", :title => "other" + resource = Puppet::Type.type(:file).create :path => "/something", :title => "other", :content => "blah" + resource.expects(:isomorphic?).returns(false) @catalog.add_resource(resource) - @catalog.resource(:exec, resource.title).should equal(resource) + @catalog.resource(:file, resource.title).should equal(resource) # We can't use .should here, because the resources respond to that method. - if @catalog.resource(:exec, resource.name) + if @catalog.resource(:file, resource.name) raise "Aliased non-isomorphic resource" end end -- cgit