From 6de1a6e0622f69ec22c64e72fd53ec12ae8c9111 Mon Sep 17 00:00:00 2001 From: Mark McKinstry Date: Thu, 15 Oct 2015 22:22:10 -0400 Subject: add functionality to bool2str to return strings of your choice for a boolean --- spec/functions/bool2str_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/functions') diff --git a/spec/functions/bool2str_spec.rb b/spec/functions/bool2str_spec.rb index 8d35598..23a754b 100755 --- a/spec/functions/bool2str_spec.rb +++ b/spec/functions/bool2str_spec.rb @@ -6,6 +6,12 @@ describe 'bool2str' do [ 'true', 'false', nil, :undef, ''].each do |invalid| it { is_expected.to run.with_params(invalid).and_raise_error(Puppet::ParseError) } end + it { is_expected.to run.with_params(true, 'yes', 'no', 'maybe').and_raise_error(Puppet::ParseError) } + it { is_expected.to run.with_params(true, 'maybe').and_raise_error(Puppet::ParseError) } + it { is_expected.to run.with_params(true, 0, 1).and_raise_error(Puppet::ParseError) } it { is_expected.to run.with_params(true).and_return("true") } it { is_expected.to run.with_params(false).and_return("false") } + it { is_expected.to run.with_params(true, 'yes', 'no').and_return("yes") } + it { is_expected.to run.with_params(false, 'yes', 'no').and_return("no") } + end -- cgit v1.2.3