From f2f2db4795fc0e3b9387e1e6c003e8e75efde903 Mon Sep 17 00:00:00 2001 From: Corey Osman Date: Thu, 3 Sep 2015 10:31:51 -0700 Subject: accept any case of boolean strings * previously the str2bool function did not accept 'TRUE' as a bool type. This causes the function to now accept TRUE, FALSE strings as a boolean type in order to be converted to a proper boolean. * This would also cause Y,N, YES, NO to be accepted as boolean types as well. --- spec/functions/str2bool_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/functions') diff --git a/spec/functions/str2bool_spec.rb b/spec/functions/str2bool_spec.rb index 3b439b2..7d8c47c 100755 --- a/spec/functions/str2bool_spec.rb +++ b/spec/functions/str2bool_spec.rb @@ -10,13 +10,13 @@ describe 'str2bool' do it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, /Unknown type of boolean given/) } describe 'when testing values that mean "true"' do - [ '1', 't', 'y', 'true', 'yes', true ].each do |value| + [ 'TRUE','1', 't', 'y', 'true', 'yes', true ].each do |value| it { is_expected.to run.with_params(value).and_return(true) } end end describe 'when testing values that mean "false"' do - [ '', '0', 'f', 'n', 'false', 'no', false, 'undef', 'undefined' ].each do |value| + [ 'FALSE','', '0', 'f', 'n', 'false', 'no', false, 'undef', 'undefined' ].each do |value| it { is_expected.to run.with_params(value).and_return(false) } end end -- cgit v1.2.3