File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
lib/puppet/parser/functions
spec/unit/puppet/parser/functions Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ module Puppet::Parser::Functions
14
14
"given (#{ arguments . size } for 1)" ) if arguments . size < 1
15
15
16
16
string = arguments [ 0 ]
17
+
18
+ # If string is already Boolean, return it
19
+ if !!string == string
20
+ return string
21
+ end
17
22
18
23
unless string . is_a? ( String )
19
24
raise ( Puppet ::ParseError , 'str2bool(): Requires either ' +
Original file line number Diff line number Diff line change 21
21
result = scope . function_str2bool ( [ "undef" ] )
22
22
result . should ( eq ( false ) )
23
23
end
24
+
25
+ it "should return the boolean it was called with" do
26
+ result = scope . function_str2bool ( [ true ] )
27
+ result . should ( eq ( true ) )
28
+ result = scope . function_str2bool ( [ false ] )
29
+ result . should ( eq ( false ) )
30
+ end
24
31
end
You can’t perform that action at this time.
0 commit comments