squeeze_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. require 'spec_helper_acceptance'
  2. describe 'squeeze function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. # Real words!
  6. $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"]
  7. $o = squeeze($a)
  8. notice(inline_template('squeeze is <%= @o.inspect %>'))
  9. DOC
  10. it 'squeezes arrays' do
  11. apply_manifest(pp1, :catch_failures => true) do |r|
  12. expect(r.stdout).to match(%r{squeeze is \["wales", "laparohysterosalpingophorectomy", "br", "godeship"\]})
  13. end
  14. end
  15. it 'squeezez arrays with an argument'
  16. pp2 = <<-DOC
  17. $a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
  18. $o = squeeze($a)
  19. notice(inline_template('squeeze is <%= @o.inspect %>'))
  20. DOC
  21. it 'squeezes strings' do
  22. apply_manifest(pp2, :catch_failures => true) do |r|
  23. expect(r.stdout).to match(%r{squeeze is "wales laparohysterosalpingophorectomy br godeship"})
  24. end
  25. end
  26. pp3 = <<-DOC
  27. $a = "countessship duchessship governessship hostessship"
  28. $o = squeeze($a, 's')
  29. notice(inline_template('squeeze is <%= @o.inspect %>'))
  30. DOC
  31. it 'squeezes strings with an argument' do
  32. apply_manifest(pp3, :catch_failures => true) do |r|
  33. expect(r.stdout).to match(%r{squeeze is "counteship ducheship governeship hosteship"})
  34. end
  35. end
  36. end
  37. describe 'failure' do
  38. it 'handles no arguments'
  39. it 'handles non strings or arrays'
  40. end
  41. end