]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(MODULES-905) Extend spec tests for bool2str
authorRyan McKern <ryan.mckern@puppetlabs.com>
Thu, 15 May 2014 23:45:02 +0000 (16:45 -0700)
committerRyan McKern <ryan.mckern@puppetlabs.com>
Thu, 15 May 2014 23:45:02 +0000 (16:45 -0700)
The extended spec tests validate that the common types of values
that could be passed to bool2str() are rejected.

spec/unit/puppet/parser/functions/bool2str_spec.rb

index c73f7df115fb4ec99314772ed6f707812584b64a..bed7e68a0e482f358ee12c8cca5e740bf4af50f0 100755 (executable)
@@ -31,4 +31,16 @@ describe "the bool2str function" do
     result = scope.function_bool2str([false])
     result.class.should(eq(String))
   end
+
+  it "should not accept a string" do
+    lambda { scope.function_bool2str(["false"]) }.should( raise_error(Puppet::ParseError))
+  end
+
+  it "should not accept a nil value" do
+    lambda { scope.function_bool2str([nil]) }.should( raise_error(Puppet::ParseError))
+  end
+
+  it "should not accept an undef" do
+    lambda { scope.function_bool2str([:undef]) }.should( raise_error(Puppet::ParseError))
+  end
 end