is_bool_spec.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. require 'spec_helper_acceptance'
  2. describe 'is_bool function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $a = ['aaa','bbb','ccc']
  6. $b = false
  7. $o = is_bool($a)
  8. if $o == $b {
  9. notify { 'output correct': }
  10. }
  11. DOC
  12. it 'is_bools arrays' do
  13. apply_manifest(pp1, :catch_failures => true) do |r|
  14. expect(r.stdout).to match(%r{Notice: output correct})
  15. end
  16. end
  17. pp2 = <<-DOC
  18. $a = true
  19. $b = true
  20. $o = is_bool($a)
  21. if $o == $b {
  22. notify { 'output correct': }
  23. }
  24. DOC
  25. it 'is_bools true' do
  26. apply_manifest(pp2, :catch_failures => true) do |r|
  27. expect(r.stdout).to match(%r{Notice: output correct})
  28. end
  29. end
  30. pp3 = <<-DOC
  31. $a = false
  32. $b = true
  33. $o = is_bool($a)
  34. if $o == $b {
  35. notify { 'output correct': }
  36. }
  37. DOC
  38. it 'is_bools false' do
  39. apply_manifest(pp3, :catch_failures => true) do |r|
  40. expect(r.stdout).to match(%r{Notice: output correct})
  41. end
  42. end
  43. pp4 = <<-DOC
  44. $a = "true"
  45. $b = false
  46. $o = is_bool($a)
  47. if $o == $b {
  48. notify { 'output correct': }
  49. }
  50. DOC
  51. it 'is_bools strings' do
  52. apply_manifest(pp4, :catch_failures => true) do |r|
  53. expect(r.stdout).to match(%r{Notice: output correct})
  54. end
  55. end
  56. pp5 = <<-DOC
  57. $a = {'aaa'=>'bbb'}
  58. $b = false
  59. $o = is_bool($a)
  60. if $o == $b {
  61. notify { 'output correct': }
  62. }
  63. DOC
  64. it 'is_bools hashes' do
  65. apply_manifest(pp5, :catch_failures => true) do |r|
  66. expect(r.stdout).to match(%r{Notice: output correct})
  67. end
  68. end
  69. end
  70. describe 'failure' do
  71. it 'handles improper argument counts'
  72. it 'handles non-arrays'
  73. end
  74. end