Merge branch '3.x' into 4.x

This commit is contained in:
Adrien Thebo 2013-03-18 15:38:07 -07:00
commit 2c1b2c07c2
2 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,11 @@ like: 0, f, n, false, no to 'false'.
string = arguments[0]
# If string is already Boolean, return it
if !!string == string
return string
end
unless string.is_a?(String)
raise(Puppet::ParseError, 'str2bool(): Requires either ' +
'string to work with')

View file

@ -21,4 +21,11 @@ describe "the str2bool function" do
result = scope.function_str2bool(["undef"])
result.should(eq(false))
end
it "should return the boolean it was called with" do
result = scope.function_str2bool([true])
result.should(eq(true))
result = scope.function_str2bool([false])
result.should(eq(false))
end
end