merge_spec.rb 800 B

12345678910111213141516171819202122
  1. require 'spec_helper_acceptance'
  2. describe 'merge function' do
  3. describe 'success' do
  4. pp = <<-DOC
  5. $a = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
  6. $b = {'two' => 'dos', 'three' => { 'five' => 5 } }
  7. $o = merge($a, $b)
  8. notice(inline_template('merge[one] is <%= @o["one"].inspect %>'))
  9. notice(inline_template('merge[two] is <%= @o["two"].inspect %>'))
  10. notice(inline_template('merge[three] is <%= @o["three"].inspect %>'))
  11. DOC
  12. regex_array = [%r{merge\[one\] is ("1"|1)}, %r{merge\[two\] is "dos"}, %r{merge\[three\] is {"five"=>("5"|5)}}]
  13. it 'merges two hashes' do
  14. apply_manifest(pp, :catch_failures => true) do |r|
  15. regex_array.each do |i|
  16. expect(r.stdout).to match(i)
  17. end
  18. end
  19. end
  20. end
  21. end