validate_bool_spec.rb 875 B

1234567891011121314151617181920212223242526272829303132333435
  1. require 'spec_helper_acceptance'
  2. describe 'validate_bool function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $one = true
  6. validate_bool($one)
  7. DOC
  8. it 'validates a single argument' do
  9. apply_manifest(pp1, :catch_failures => true)
  10. end
  11. pp2 = <<-DOC
  12. $one = true
  13. $two = false
  14. validate_bool($one,$two)
  15. DOC
  16. it 'validates an multiple arguments' do
  17. apply_manifest(pp2, :catch_failures => true)
  18. end
  19. [
  20. %{validate_bool('true')},
  21. %{validate_bool('false')},
  22. %{validate_bool([true])},
  23. %{validate_bool(undef)},
  24. ].each do |pp3|
  25. it "rejects #{pp3.inspect}" do
  26. expect(apply_manifest(pp3, :expect_failures => true).stderr).to match(%r{is not a boolean\. It looks to be a})
  27. end
  28. end
  29. end
  30. describe 'failure' do
  31. it 'handles improper number of arguments'
  32. end
  33. end