diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-02-12 11:52:21 -0800 |
|---|---|---|
| committer | Daniel Pittman <daniel@rimspace.net> | 2011-02-12 11:52:21 -0800 |
| commit | 16e79f075622aa155a112d5a271c386f4ebc0241 (patch) | |
| tree | 436218854ccc50181dd7cf985d1ca261c3950b8e /spec/unit/parser/parser_spec.rb | |
| parent | 781601f8e7a9c6aecc5c9de66b1597b1879450d2 (diff) | |
| parent | b5b5923bf41196f5e72a69bfa627120c75732fe5 (diff) | |
| download | puppet-16e79f075622aa155a112d5a271c386f4ebc0241.tar.gz puppet-16e79f075622aa155a112d5a271c386f4ebc0241.tar.xz puppet-16e79f075622aa155a112d5a271c386f4ebc0241.zip | |
Merge branch 'bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class' into 2.6.next
Diffstat (limited to 'spec/unit/parser/parser_spec.rb')
| -rwxr-xr-x | spec/unit/parser/parser_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 07e2d220b..2f5d4b8ea 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -276,7 +276,7 @@ describe Puppet::Parser do it "should include docs when the AST class uses them" do @class.expects(:use_docs).returns true @class.stubs(:new) - @parser.expects(:ast_context).with{ |a| a[0] == true }.returns({}) + @parser.expects(:ast_context).with{ |docs, line| docs == true }.returns({}) @parser.ast(@class, :file => "/bar") end @@ -304,6 +304,33 @@ describe Puppet::Parser do it "should return an array of nodes" do @parser.newnode(@nodename).should be_instance_of(Array) end + + it "should initialize the ast context with the correct line number" do + @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({}) + @parser.newnode(@nodename, { :line => 123 }) + end + end + + %w{class define}.each do |entity| + describe "when creating a #{entity}" do + before :each do + @parser.stubs(:ast_context).returns({}) + + @name = stub "#{entity}name", :is_a? => false, :value => "foo" + end + + it "should create and add the correct resource type" do + instance = stub 'instance' + Puppet::Resource::Type.expects(:new).returns(instance) + @parser.known_resource_types.expects(:add).with(instance) + @parser.send("new#{entity}", @name) + end + + it "should initialize the ast context with the correct line number" do + @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({}) + @parser.send("new#{entity}", @name, { :line => 123 }) + end + end end describe "when retrieving a specific node" do |
