summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2009-10-26 00:43:29 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-10-27 10:35:02 +1100
commit73d04c6b15e1b626cd7dea1f963a5ca02a810137 (patch)
tree981addbae93abc82a2998975ea49003b72d8afec /spec
parent7517572949e4e0efc419f97cf2663588af8b9756 (diff)
downloadpuppet-73d04c6b15e1b626cd7dea1f963a5ca02a810137.tar.gz
puppet-73d04c6b15e1b626cd7dea1f963a5ca02a810137.tar.xz
puppet-73d04c6b15e1b626cd7dea1f963a5ca02a810137.zip
Bug #2534 Raise error if property appears twice
This patch changes Puppet::Parser::Resource to check if it has been passed two Puppet::Parser::Resource::Param objects with the same name. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/parser/resource.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 0a67c4b54..3f08de958 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -25,7 +25,7 @@ describe Puppet::Parser::Resource do
params = args[:params] || {:one => "yay", :three => "rah"}
if args[:params] == :none
args.delete(:params)
- else
+ elsif not args[:params].is_a? Array
args[:params] = paramify(args[:source], params)
end
@@ -483,5 +483,18 @@ describe Puppet::Parser::Resource do
result = @parser_resource.to_resource
result[:fee].should == ["a", Puppet::Resource::Reference.new(:file, "/my/file1"), Puppet::Resource::Reference.new(:file, "/my/file2")]
end
+
+ it "should fail if the same param is declared twice" do
+ lambda do
+ @parser_resource = mkresource :source => @source, :params => [
+ Puppet::Parser::Resource::Param.new(
+ :name => :foo, :value => "bar", :source => @source
+ ),
+ Puppet::Parser::Resource::Param.new(
+ :name => :foo, :value => "baz", :source => @source
+ )
+ ]
+ end.should raise_error(Puppet::ParseError)
+ end
end
end