str2bool_spec.rb 721 B

1234567891011121314151617181920212223242526272829
  1. require 'spec_helper_acceptance'
  2. describe 'str2bool function' do
  3. describe 'success' do
  4. pp = <<-DOC
  5. $o = str2bool('y')
  6. notice(inline_template('str2bool is <%= @o.inspect %>'))
  7. DOC
  8. it 'works with "y"' do
  9. apply_manifest(pp, :catch_failures => true) do |r|
  10. expect(r.stdout).to match(%r{str2bool is true})
  11. end
  12. end
  13. it 'works with "Y"'
  14. it 'works with "yes"'
  15. it 'works with "1"'
  16. it 'works with "true"'
  17. it 'works with "n"'
  18. it 'works with "N"'
  19. it 'works with "no"'
  20. it 'works with "0"'
  21. it 'works with "false"'
  22. it 'works with undef'
  23. end
  24. describe 'failure' do
  25. it 'handles no arguments'
  26. it 'handles non arrays or strings'
  27. end
  28. end