summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-09-28 12:32:40 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-28 19:42:05 -0700
commit574812ef00e6681fce88bd1e66bbc07e7ade4b41 (patch)
tree7ceae2a870586bcb7148a021ab34aa0129aac396
parent68947e7f31b6145bf50935ffcd5c10f1c6609eb4 (diff)
downloadpuppet-574812ef00e6681fce88bd1e66bbc07e7ade4b41.tar.gz
puppet-574812ef00e6681fce88bd1e66bbc07e7ade4b41.tar.xz
puppet-574812ef00e6681fce88bd1e66bbc07e7ade4b41.zip
(#4860) Add regression tests that would have caught bad params method
This is another case where our test objects were overly mocked so they didn't alert us to problems with our implementation.
-rw-r--r--lib/puppet/parser/ast/resource.rb6
-rwxr-xr-xspec/unit/util/rdoc/parser_spec.rb30
2 files changed, 18 insertions, 18 deletions
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 0c58538d5..6909c85c2 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 3614c0a3c..28c33c295 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)