bool2str_spec.rb 879 B

12345678910111213141516
  1. require 'spec_helper'
  2. describe 'bool2str' do
  3. it { is_expected.not_to eq(nil) }
  4. it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
  5. ['true', 'false', nil, :undef, ''].each do |invalid|
  6. it { is_expected.to run.with_params(invalid).and_raise_error(Puppet::ParseError) }
  7. end
  8. it { is_expected.to run.with_params(true, 'yes', 'no', 'maybe').and_raise_error(Puppet::ParseError) }
  9. it { is_expected.to run.with_params(true, 'maybe').and_raise_error(Puppet::ParseError) }
  10. it { is_expected.to run.with_params(true, 0, 1).and_raise_error(Puppet::ParseError) }
  11. it { is_expected.to run.with_params(true).and_return('true') }
  12. it { is_expected.to run.with_params(false).and_return('false') }
  13. it { is_expected.to run.with_params(true, 'yes', 'no').and_return('yes') }
  14. it { is_expected.to run.with_params(false, 'yes', 'no').and_return('no') }
  15. end