diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-11-26 20:14:36 +0100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-02 13:10:49 +1100 |
commit | 61d19116aa53dd62ff214300fba9ec03a6699876 (patch) | |
tree | 31394514bb7a3f38c8c4b07c482ed95c4a02f39c /spec/unit/util/rdoc/parser.rb | |
parent | e63d23e359e72e8cfea950c13b4fcc21cbf102e2 (diff) | |
download | puppet-61d19116aa53dd62ff214300fba9ec03a6699876.tar.gz puppet-61d19116aa53dd62ff214300fba9ec03a6699876.tar.xz puppet-61d19116aa53dd62ff214300fba9ec03a6699876.zip |
Fix 2841 - Puppetdoc/RDoc parses realize function
Puppetdoc wasn't parsing the realize function.
This patch let puppetdoc find realize and display in RDoc html
mode the list of realized resource per class or node.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/util/rdoc/parser.rb')
-rwxr-xr-x | spec/unit/util/rdoc/parser.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/unit/util/rdoc/parser.rb b/spec/unit/util/rdoc/parser.rb index 85a62e717..593e6acc8 100755 --- a/spec/unit/util/rdoc/parser.rb +++ b/spec/unit/util/rdoc/parser.rb @@ -372,6 +372,36 @@ describe RDoc::Parser do end end + describe "when scanning for realized virtual resources" do + + def create_stmt + stmt_value = stub "resource_ref", :to_s => "File[\"/tmp/a\"]" + stmt = stub_everything 'stmt', :name => "realize", :arguments => [stmt_value], :doc => "mydoc" + stmt.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(false) + stmt.stubs(:is_a?).with(Puppet::Parser::AST::Function).returns(true) + stmt + end + + before(:each) do + @class = stub_everything 'class' + @code = stub_everything 'code' + @code.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(true) + end + + it "should also scan mono-instruction code" do + @class.expects(:add_realize).with { |i| i.is_a?(RDoc::Include) and i.name == "File[\"/tmp/a\"]" and i.comment == "mydoc" } + + @parser.scan_for_realize(@class,create_stmt()) + end + + it "should register recursively includes to the current container" do + @code.stubs(:children).returns([ create_stmt() ]) + + @class.expects(:add_realize).with { |i| i.is_a?(RDoc::Include) and i.name == "File[\"/tmp/a\"]" and i.comment == "mydoc" } + @parser.scan_for_realize(@class, [@code]) + end + end + describe "when scanning for variable definition" do before :each do @class = stub_everything 'class' |