From 491c31dcbdb0977c0377cb276cfe32a4c24e0e1a Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 22 Aug 2010 10:14:03 -0700 Subject: Fix for #4542 -- included classes weren't assigned proper stages This commit unifies the code paths on which classes are added, alters the default stage to respect the stage of the parent if any, and assures that the resource is notified if its stage is assigned (turning an implicit stage into an explicit one). --- spec/unit/parser/compiler_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'spec/unit/parser/compiler_spec.rb') diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index e8c06dd0b..22d52f257 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -430,7 +430,18 @@ describe Puppet::Parser::Compiler do lambda { @compiler.add_resource(@scope, resource) }.should raise_error(ArgumentError) end - it "should add edges from the class resources to the main stage if no stage is specified" do + it "should add edges from the class resources to the parent's stage if no stage is specified" do + main = @compiler.catalog.resource(:stage, :main) + foo_stage = resource(:stage, :foo_stage) + @compiler.add_resource(@scope, foo_stage) + resource = resource(:class, "foo") + @scope.stubs(:resource).returns(:stage => :foo_stage) + @compiler.add_resource(@scope, resource) + + @compiler.catalog.should be_edge(foo_stage, resource) + end + + it "should add edges from top-level class resources to the main stage if no stage is specified" do main = @compiler.catalog.resource(:stage, :main) resource = resource(:class, "foo") @compiler.add_resource(@scope, resource) -- cgit