summaryrefslogtreecommitdiff
path: root/spec/functions
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functions')
-rwxr-xr-xspec/functions/validate_integer_spec.rb5
-rwxr-xr-xspec/functions/validate_numeric_spec.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/spec/functions/validate_integer_spec.rb b/spec/functions/validate_integer_spec.rb
index 3865c4f..e95da6a 100755
--- a/spec/functions/validate_integer_spec.rb
+++ b/spec/functions/validate_integer_spec.rb
@@ -62,6 +62,11 @@ describe Puppet::Parser::Functions.function(:validate_integer) do
expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be an Integer or Array/)
end
+ it "should not compile when a Hash is passed as Array" do
+ Puppet[:code] = "validate_integer([{ 1 => 2 }])"
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be an Integer/)
+ end
+
it "should not compile when an explicitly undef variable is passed" do
Puppet[:code] = <<-'ENDofPUPPETcode'
$foo = undef
diff --git a/spec/functions/validate_numeric_spec.rb b/spec/functions/validate_numeric_spec.rb
index 1623a3d..c99d879 100755
--- a/spec/functions/validate_numeric_spec.rb
+++ b/spec/functions/validate_numeric_spec.rb
@@ -62,6 +62,11 @@ describe Puppet::Parser::Functions.function(:validate_numeric) do
expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric or Array/)
end
+ it "should not compile when a Hash is passed in an Array" do
+ Puppet[:code] = "validate_numeric([{ 1 => 2 }])"
+ expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /to be a Numeric/)
+ end
+
it "should not compile when an explicitly undef variable is passed" do
Puppet[:code] = <<-'ENDofPUPPETcode'
$foo = undef