is_array_spec.rb 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. require 'spec_helper_acceptance'
  2. describe 'is_array function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $a = ['aaa','bbb','ccc']
  6. $b = true
  7. $o = is_array($a)
  8. if $o == $b {
  9. notify { 'output correct': }
  10. }
  11. DOC
  12. it 'is_arrays 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 = []
  19. $b = true
  20. $o = is_array($a)
  21. if $o == $b {
  22. notify { 'output correct': }
  23. }
  24. DOC
  25. it 'is_arrays empty arrays' 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 = "aoeu"
  32. $b = false
  33. $o = is_array($a)
  34. if $o == $b {
  35. notify { 'output correct': }
  36. }
  37. DOC
  38. it 'is_arrays strings' 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 = {'aaa'=>'bbb'}
  45. $b = false
  46. $o = is_array($a)
  47. if $o == $b {
  48. notify { 'output correct': }
  49. }
  50. DOC
  51. it 'is_arrays hashes' 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. end
  57. describe 'failure' do
  58. it 'handles improper argument counts'
  59. it 'handles non-arrays'
  60. end
  61. end