summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-06-02 15:56:22 -0700
committerMax Martin <max@puppetlabs.com>2011-06-02 15:56:22 -0700
commit4801e10c81264b20c2d35b0d44c10cfb0668d1b9 (patch)
tree3e3024bbd4a46a3ab2af5bf29ec2f3b30db270d7 /spec/unit/parser
parent520cbc0292ec0cf75b6871bb0a4bc12bce506bb0 (diff)
parent4ad88017d3b8b8000325f5165520a6c21b48c469 (diff)
downloadpuppet-4801e10c81264b20c2d35b0d44c10cfb0668d1b9.tar.gz
puppet-4801e10c81264b20c2d35b0d44c10cfb0668d1b9.tar.xz
puppet-4801e10c81264b20c2d35b0d44c10cfb0668d1b9.zip
Merge branch '2.7.x'
* 2.7.x: (40 commits) (#7746) Fix bootstrap issues from #7717 fix. (#7683) Use ronn, when available, to render the output. (#7683) Add a 'man' face and subcommand to Puppet. maint: remove obsolete work-around code from help face. (#7699) Don't duplicate inherited action names on faces. (#7177) Deprecate implicit 'puppet apply' for 2.7.0 (#7717) Layout cleanup for subcommand extraction. #7211: Test unknown options don't shadow unknown actions. #7211: nasty logic error with global Face options taking arguments. #7211: more helpful error messages in various cases. maint: Fix order dependent test failure (#5966) Add support for hostname regular expressions in auth.conf (#7708) Delete extended documentation from configuration reference (#7707) Document signals in puppet agent and puppet master help add puppet master polling step for ticket 7117 (#5318) Always notice changes to manifests when compiling. (#5318) Always notice changes to manifests when compiling. (#7557) Remove Faces Application maint: Fix order dependent spec failure for face indirection (#7690) Don't blow up when listing terminuses available for faces ... Conflicts (resolved manually): acceptance/tests/ticket_7117_broke_env_criteria_authconf.rb
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/ast/resource_reference_spec.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb
index 627754dd1..4d1c191cf 100755
--- a/spec/unit/parser/ast/resource_reference_spec.rb
+++ b/spec/unit/parser/ast/resource_reference_spec.rb
@@ -9,21 +9,25 @@ describe Puppet::Parser::AST::ResourceReference do
@scope = Puppet::Parser::Scope.new
end
+ def ast_name(value)
+ Puppet::Parser::AST::Name.new(:value => value)
+ end
+
def newref(type, title)
- title = stub 'title', :safeevaluate => title
- ref = Puppet::Parser::AST::ResourceReference.new(:type => type, :title => title)
+ title_array = Puppet::Parser::AST::ASTArray.new(:children => [title])
+ ref = Puppet::Parser::AST::ResourceReference.new(:type => type, :title => title_array)
end
it "should correctly produce reference strings" do
- newref("File", "/tmp/yay").evaluate(@scope).to_s.should == "File[/tmp/yay]"
+ newref("File", ast_name("/tmp/yay")).evaluate(@scope).to_s.should == "File[/tmp/yay]"
end
it "should produce a single resource when the title evaluates to a string" do
- newref("File", "/tmp/yay").evaluate(@scope).should == Puppet::Resource.new("file", "/tmp/yay")
+ newref("File", ast_name("/tmp/yay")).evaluate(@scope).should == Puppet::Resource.new("file", "/tmp/yay")
end
it "should return an array of resources if given an array of titles" do
- titles = mock 'titles', :safeevaluate => ["title1","title2"]
+ titles = Puppet::Parser::AST::ASTArray.new(:children => [ast_name("title1"), ast_name("title2")])
ref = ast::ResourceReference.new( :title => titles, :type => "File" )
ref.evaluate(@scope).should == [
Puppet::Resource.new("file", "title1"),
@@ -31,6 +35,16 @@ describe Puppet::Parser::AST::ResourceReference do
]
end
+ it "should return an array of resources if given a variable containing an array of titles" do
+ @scope.setvar("my_files", ["foo", "bar"])
+ titles = Puppet::Parser::AST::Variable.new(:value => "my_files")
+ ref = newref('File', titles)
+ ref.evaluate(@scope).should == [
+ Puppet::Resource.new("file", "foo"),
+ Puppet::Resource.new("file", "bar")
+ ]
+ end
+
it "should return a correct representation when converting to string" do
type = stub 'type', :is_a? => true, :to_s => "file"
title = stub 'title', :is_a? => true, :to_s => "[/tmp/a, /tmp/b]"