abs_spec.rb 621 B

123456789101112131415161718192021222324252627
  1. require 'spec_helper_acceptance'
  2. describe 'abs function' do
  3. describe 'success' do
  4. pp1 = <<-DOC
  5. $input = '-34.56'
  6. $output = abs($input)
  7. notify { "$output": }
  8. DOC
  9. it 'accepts a string' do
  10. apply_manifest(pp1, :catch_failures => true) do |r|
  11. expect(r.stdout).to match(%r{Notice: 34.56})
  12. end
  13. end
  14. pp2 = <<-DOC
  15. $input = -35.46
  16. $output = abs($input)
  17. notify { "$output": }
  18. DOC
  19. it 'accepts a float' do
  20. apply_manifest(pp2, :catch_failures => true) do |r|
  21. expect(r.stdout).to match(%r{Notice: 35.46})
  22. end
  23. end
  24. end
  25. end