clamp_spec.rb 856 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. require 'spec_helper_acceptance'
  2. describe 'clamp function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $x = 17
  6. $y = 225
  7. $z = 155
  8. $o = clamp($x, $y, $z)
  9. if $o == $z {
  10. notify { 'output correct': }
  11. }
  12. DOC
  13. it 'clamps list of values' do
  14. apply_manifest(pp1, :catch_failures => true) do |r|
  15. expect(r.stdout).to match(%r{Notice: output correct})
  16. end
  17. end
  18. pp2 = <<-DOC
  19. $a = [7, 19, 66]
  20. $b = 19
  21. $o = clamp($a)
  22. if $o == $b {
  23. notify { 'output correct': }
  24. }
  25. DOC
  26. it 'clamps array of values' do
  27. apply_manifest(pp2, :catch_failures => true) do |r|
  28. expect(r.stdout).to match(%r{Notice: output correct})
  29. end
  30. end
  31. end
  32. describe 'failure' do
  33. it 'handles improper argument counts'
  34. it 'handles no arguments'
  35. end
  36. end