summaryrefslogtreecommitdiffstats
path: root/spec/unit/node
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/node')
-rwxr-xr-xspec/unit/node/catalog.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index aa49909e2..be4edb65d 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -455,6 +455,11 @@ describe Puppet::Node::Catalog, " when functioning as a resource container" do
proc { @catalog.alias @two, "one" }.should raise_error(ArgumentError)
end
+ it "should not fail when a resource has duplicate aliases created" do
+ @catalog.add_resource @one
+ proc { @catalog.alias @one, "one" }.should_not raise_error
+ end
+
it "should remove resource aliases when the target resource is removed" do
@catalog.add_resource @one
@catalog.alias(@one, "other")
@@ -463,6 +468,14 @@ describe Puppet::Node::Catalog, " when functioning as a resource container" do
@catalog.resource("me", "other").should be_nil
end
+ it "should add an alias for the namevar when the title and name differ" do
+ @one.stubs(:name).returns "other"
+ resource = Puppet::Type.type(:file).create :path => "/something", :title => "other", :content => "blah"
+ @catalog.add_resource(resource)
+ @catalog.resource(:file, "other").should equal(resource)
+ @catalog.resource(:file, "/something").should equal(resource)
+ end
+
after do
Puppet::Type.allclear
end