+1

On Mon, Dec 28, 2009 at 7:54 AM, Brice Figureau
<[email protected]> wrote:
> When the definition/hostclass/node AST types were removed, the
> parentclass method was renamed to 'parent'.
> This patch fixes the incorrect rdoc usage (and some deeper
> integration test so that it won't happen again).
>
> Signed-off-by: Brice Figureau <[email protected]>
> ---
>  lib/puppet/util/rdoc/parser.rb       |    6 +++---
>  spec/integration/util/rdoc/parser.rb |   17 +++++++++++++++++
>  spec/unit/util/rdoc/parser.rb        |    4 ++--
>  3 files changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
> index 4d0ac48..9a2bef9 100644
> --- a/lib/puppet/util/rdoc/parser.rb
> +++ b/lib/puppet/util/rdoc/parser.rb
> @@ -236,7 +236,7 @@ class Parser
>         Puppet.debug "rdoc: found new class %s" % name
>         container, name = get_class_or_module(container, name)
>
> -        superclass = klass.parentclass
> +        superclass = klass.parent
>         superclass = "" if superclass.nil? or superclass.empty?
>
>         @stats.num_classes += 1
> @@ -266,7 +266,7 @@ class Parser
>     # create documentation for a node
>     def document_node(name, node, container)
>         Puppet.debug "rdoc: found new node %s" % name
> -        superclass = node.parentclass
> +        superclass = node.parent
>         superclass = "" if superclass.nil? or superclass.empty?
>
>         comment = node.doc
> @@ -294,7 +294,7 @@ class Parser
>         # find superclas if any
>         @stats.num_methods += 1
>
> -        # find the parentclass
> +        # find the parent
>         # split define name by :: to find the complete module hierarchy
>         container, name = get_class_or_module(container,name)
>
> diff --git a/spec/integration/util/rdoc/parser.rb 
> b/spec/integration/util/rdoc/parser.rb
> index 5426609..1dd36c6 100755
> --- a/spec/integration/util/rdoc/parser.rb
> +++ b/spec/integration/util/rdoc/parser.rb
> @@ -35,8 +35,25 @@ describe RDoc::Parser do
>         File.unlink(@parsedfile)
>     end
>
> +    def get_test_class(toplevel)
> +        # toplevel -> main -> test
> +        toplevel.classes[0].classes[0]
> +    end
> +
>     it "should parse to RDoc data structure" do
>         @parser.expects(:document_class).with { |n,k,c| n == "::test" and 
> k.is_a?(Puppet::Parser::ResourceType) }
>         @parser.scan
>     end
> +
> +    it "should get a PuppetClass for the main class" do
> +       �[email protected][0].should be_a RDoc::PuppetClass
> +    end
> +
> +    it "should produce a PuppetClass whose name is test" do
> +        get_test_class(@parser.scan).name.should == "test"
> +    end
> +
> +    it "should produce a PuppetClass whose comment is 'comment'" do
> +        get_test_class(@parser.scan).comment.should == "comment\n"
> +    end
>  end
> diff --git a/spec/unit/util/rdoc/parser.rb b/spec/unit/util/rdoc/parser.rb
> index 19c91bb..ce776da 100755
> --- a/spec/unit/util/rdoc/parser.rb
> +++ b/spec/unit/util/rdoc/parser.rb
> @@ -252,7 +252,7 @@ describe RDoc::Parser do
>     describe "when documenting nodes" do
>         before :each do
>             @code = stub_everything 'code'
> -           �...@node = stub_everything 'node', :doc => "mydoc", :parentclass 
> => "parent", :code => @code, :file => "file", :line => 42
> +           �...@node = stub_everything 'node', :doc => "mydoc", :parent => 
> "parent", :code => @code, :file => "file", :line => 42
>             @rdoc_node = stub_everything 'rdocnode'
>
>             @class = stub_everything 'class'
> @@ -295,7 +295,7 @@ describe RDoc::Parser do
>     describe "when documenting classes" do
>         before :each do
>             @code = stub_everything 'code'
> -           �...@class = stub_everything 'class', :doc => "mydoc", 
> :parentclass => "parent", :code => @code, :file => "file", :line => 42
> +           �...@class = stub_everything 'class', :doc => "mydoc", :parent => 
> "parent", :code => @code, :file => "file", :line => 42
>             @rdoc_class = stub_everything 'rdoc-class'
>
>             @module = stub_everything 'class'
> --
> 1.6.5.2
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.
>
>
>



-- 
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.


Reply via email to