From 42bfdf2fc7affa91265043e583c9673b738d22dd Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 25 Feb 2008 19:53:24 -0500 Subject: Fixing #1085, I think -- I was not returning a resource if the class had already been evaluated, but this was only being run into in corner cases -- mostly where one class included another class, I assume. --- spec/unit/parser/ast/hostclass.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/unit/parser/ast/hostclass.rb b/spec/unit/parser/ast/hostclass.rb index a53c3b092..0abc174d9 100755 --- a/spec/unit/parser/ast/hostclass.rb +++ b/spec/unit/parser/ast/hostclass.rb @@ -42,6 +42,12 @@ describe Puppet::Parser::AST::HostClass do @top.evaluate(@scope) end + it "should return the existing resource when not creating a new one" do + @compiler.catalog.expects(:resource).with(:class, "top").returns("something") + @compiler.catalog.expects(:add_resource).never + @top.evaluate(@scope).should == "something" + end + it "should not create a new parent resource if one already exists and it has a parent class" do @top.evaluate(@scope) @@ -126,4 +132,4 @@ describe Puppet::Parser::AST::HostClass do @compiler.class_scope(@middle).namespaces.should be_include(@top.namespace) end end -end \ No newline at end of file +end -- cgit