From 38ec9fcc5f3965942a74c8d7b7dfd1cf1796c0df Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Tue, 10 Nov 2009 18:19:59 +0100 Subject: Fix #2796 - Fix puppetdoc rdoc selector parsing This patch fix this bug by adding more to_s methods to ast member so that puppetdoc can just to_s the AST to reconstruct the original puppet code. Of course this is not perfect, but should work most of the time. Signed-off-by: Brice Figureau --- spec/unit/parser/ast/leaf.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/unit/parser/ast/leaf.rb') diff --git a/spec/unit/parser/ast/leaf.rb b/spec/unit/parser/ast/leaf.rb index e9681503d..fecfba386 100755 --- a/spec/unit/parser/ast/leaf.rb +++ b/spec/unit/parser/ast/leaf.rb @@ -72,6 +72,15 @@ describe Puppet::Parser::AST::String do end end +describe Puppet::Parser::AST::Variable do + describe "when converting to string" do + it "should transform its value to a variable" do + value = stub 'value', :is_a? => true, :to_s => "myvar" + Puppet::Parser::AST::Variable.new( :value => value ).to_s.should == "\$myvar" + end + end +end + describe Puppet::Parser::AST::Regex do before :each do @scope = stub 'scope' -- cgit