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
1414 "given (#{ arguments . size } for 1)" ) if arguments . size < 1
1515
1616 string = arguments [ 0 ]
17+
18+ # If string is already Boolean, return it
19+ if !!string == string
20+ return string
21+ end
1722
1823 unless string . is_a? ( String )
1924 raise ( Puppet ::ParseError , 'str2bool(): Requires either ' +
Original file line number Diff line number Diff line change 2121 result = scope . function_str2bool ( [ "undef" ] )
2222 result . should ( eq ( false ) )
2323 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
2431end
You can’t perform that action at this time.
0 commit comments