is_a_spec.rb 666 B

123456789101112131415161718192021222324252627
  1. require 'spec_helper_acceptance'
  2. if return_puppet_version =~ %r{^4}
  3. describe 'is_a function' do
  4. pp1 = <<-DOC
  5. if 'hello world'.is_a(String) {
  6. notify { 'output correct': }
  7. }
  8. DOC
  9. it 'matches a string' do
  10. apply_manifest(pp1, :catch_failures => true) do |r|
  11. expect(r.stdout).to match(%r{Notice: output correct})
  12. end
  13. end
  14. pp2 = <<-DOC
  15. if 5.is_a(String) {
  16. notify { 'output wrong': }
  17. }
  18. DOC
  19. it 'does not match a integer as string' do
  20. apply_manifest(pp2, :catch_failures => true) do |r|
  21. expect(r.stdout).not_to match(%r{Notice: output wrong})
  22. end
  23. end
  24. end
  25. end