This is another case where our test objects were overly mocked so they
didn't alert us to problems with our implementation.

Signed-off-by: Matt Robinson <[email protected]>
---
 lib/puppet/parser/ast/resource.rb  |    6 +-----
 spec/unit/util/rdoc/parser_spec.rb |   30 +++++++++++++++++-------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/puppet/parser/ast/resource.rb 
b/lib/puppet/parser/ast/resource.rb
index 0c58538..6909c85 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -46,7 +46,6 @@ class Resource < AST::ResourceReference
           :virtual => virt,
           :source => scope.source,
           :scope => scope,
-        
           :strict => true
         )
 
@@ -64,12 +63,9 @@ class Resource < AST::ResourceReference
     if params.is_a?(AST::ASTArray)
       @parameters = params
     else
-
-            @parameters = AST::ASTArray.new(
-                
+      @parameters = AST::ASTArray.new(
         :line => params.line,
         :file => params.file,
-        
         :children => [params]
       )
     end
diff --git a/spec/unit/util/rdoc/parser_spec.rb 
b/spec/unit/util/rdoc/parser_spec.rb
index 79195e6..6918e31 100755
--- a/spec/unit/util/rdoc/parser_spec.rb
+++ b/spec/unit/util/rdoc/parser_spec.rb
@@ -340,10 +340,12 @@ describe RDoc::Parser do
 
     def create_stmt(name)
       stmt_value = stub "#{name}_value", :value => "myclass"
-      stmt = stub_everything 'stmt', :name => name, :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
+
+      Puppet::Parser::AST::Function.new(
+        :name      => name,
+        :arguments => [stmt_value],
+        :doc       => 'mydoc'
+      )
     end
 
     before(:each) do
@@ -377,10 +379,11 @@ describe RDoc::Parser 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
+      Puppet::Parser::AST::Function.new(
+        :name      => 'realize',
+        :arguments => [stmt_value],
+        :doc       => 'mydoc'
+      )
     end
 
     before(:each) do
@@ -432,11 +435,12 @@ describe RDoc::Parser do
   describe "when scanning for resources" do
     before :each do
       @class = stub_everything 'class'
-
-      param = stub 'params', :children => []
-      @stmt = stub_everything 'stmt', :type => "File", :title => "myfile", 
:doc => "mydoc", :params => param
-      @stmt.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(false)
-      @stmt.stubs(:is_a?).with(Puppet::Parser::AST::Resource).returns(true)
+      @stmt = Puppet::Parser::AST::Resource.new(
+        :type       => "File",
+        :title      => "myfile",
+        :doc        => 'mydoc',
+        :parameters => Puppet::Parser::AST::ASTArray.new(:children => [])
+      )
 
       @code = stub_everything 'code'
       @code.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(true)
-- 
1.7.1

-- 
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