8d8f9b5bc8149409e14f406643a0c1925d8e30eb
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / bool2str_spec.rb
1 require 'spec_helper'
2
3 describe 'bool2str' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
6   ['true', 'false', nil, :undef, ''].each do |invalid|
7     it { is_expected.to run.with_params(invalid).and_raise_error(Puppet::ParseError) }
8   end
9   it { is_expected.to run.with_params(true, 'yes', 'no', 'maybe').and_raise_error(Puppet::ParseError) }
10   it { is_expected.to run.with_params(true, 'maybe').and_raise_error(Puppet::ParseError) }
11   it { is_expected.to run.with_params(true, 0, 1).and_raise_error(Puppet::ParseError) }
12   it { is_expected.to run.with_params(true).and_return('true') }
13   it { is_expected.to run.with_params(false).and_return('false') }
14   it { is_expected.to run.with_params(true, 'yes', 'no').and_return('yes') }
15   it { is_expected.to run.with_params(false, 'yes', 'no').and_return('no') }
16 end