summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/ast/hostclass.rb
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-10-11 18:45:16 +0200
committerJames Turnbull <james@lovedthanlost.net>2008-10-28 11:50:10 +1100
commit9ecbd6306d227189ba161954aafc3e7f782a87b9 (patch)
tree306937bbf0ec5d77346635945de0918b3eb716d8 /spec/unit/parser/ast/hostclass.rb
parent6539f55b16f44b4af0e706f696bab73b49d9d802 (diff)
downloadpuppet-9ecbd6306d227189ba161954aafc3e7f782a87b9.tar.gz
puppet-9ecbd6306d227189ba161954aafc3e7f782a87b9.tar.xz
puppet-9ecbd6306d227189ba161954aafc3e7f782a87b9.zip
Fixed #1104 - Classes and nodes should set $name variables
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/parser/ast/hostclass.rb')
-rwxr-xr-xspec/unit/parser/ast/hostclass.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/parser/ast/hostclass.rb b/spec/unit/parser/ast/hostclass.rb
index 0abc174d9..10aa62176 100755
--- a/spec/unit/parser/ast/hostclass.rb
+++ b/spec/unit/parser/ast/hostclass.rb
@@ -123,6 +123,19 @@ describe Puppet::Parser::AST::HostClass do
@compiler.class_scope(@middle).parent.should equal(@compiler.class_scope(@top))
end
+ it "should add the class's name and title to its own scope" do
+ @top_resource.stubs(:safeevaluate)
+ @middle_resource.stubs(:safeevaluate)
+ resource = @middle.evaluate(@scope)
+ scope = stub_everything 'scope', :compiler => @compiler
+ @middle.stubs(:subscope).returns(scope)
+
+ scope.expects(:setvar).with("title","top::middle")
+ scope.expects(:setvar).with("name","top::middle")
+
+ @middle.evaluate_code(resource)
+ end
+
it "should add the parent class's namespace to its namespace search path" do
@top_resource.stubs(:safeevaluate)
@middle_resource.stubs(:safeevaluate)