From afb78e2b253dfe43816e20afa2f4732eb9dc17eb Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 13 Mar 2014 18:21:38 +0000 Subject: Add some acceptance tests for functions. --- spec/acceptance/deep_merge_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/acceptance/deep_merge_spec.rb (limited to 'spec/acceptance/deep_merge_spec.rb') diff --git a/spec/acceptance/deep_merge_spec.rb b/spec/acceptance/deep_merge_spec.rb new file mode 100644 index 0000000..c7f35be --- /dev/null +++ b/spec/acceptance/deep_merge_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper_acceptance' + +describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should deep merge two hashes' do + pp = <<-EOS + $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } + $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } + $merged_hash = deep_merge($hash1, $hash2) + + if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } { + fail("Hash was incorrectly merged.") + } + EOS + + apply_manifest(pp, :catch_failures => true) + end +end -- cgit v1.2.3