diff options
Diffstat (limited to 'spec/hashie/extensions/deep_merge_spec.rb')
-rw-r--r-- | spec/hashie/extensions/deep_merge_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/hashie/extensions/deep_merge_spec.rb b/spec/hashie/extensions/deep_merge_spec.rb index d835381..ea88ee6 100644 --- a/spec/hashie/extensions/deep_merge_spec.rb +++ b/spec/hashie/extensions/deep_merge_spec.rb @@ -5,16 +5,17 @@ describe Hashie::Extensions::DeepMerge do subject{ DeepMergeHash } - let(:h1) { subject.new.merge(:a => "a", :b => "b", :c => { :c1 => "c1", :c2 => "c2", :c3 => { :d1 => "d1" } }) } - let(:h2) { { :a => 1, :c => { :c1 => 2, :c3 => { :d2 => "d2" } } } } - let(:expected_hash) { { :a => 1, :b => "b", :c => { :c1 => 2, :c2 => "c2", :c3 => { :d1 => "d1", :d2 => "d2" } } } } + let(:h1) { subject.new.merge(:a => "a", :a1 => 42, :b => "b", :c => { :c1 => "c1", :c2 => {:a => "b"}, :c3 => { :d1 => "d1" } }) } + let(:h2) { { :a => 1, :a1 => 1, :c => { :c1 => 2, :c2 => "c2", :c3 => { :d2 => "d2" } } } } + let(:expected_hash) { { :a => 1, :a1 => 1, :b => "b", :c => { :c1 => 2, :c2 => "c2", :c3 => { :d1 => "d1", :d2 => "d2" } } } } - it 'should deep merge two hashes' do + it 'deep merges two hashes' do h1.deep_merge(h2).should == expected_hash end - it 'should deep merge two hashes with bang method' do + it 'deep merges another hash in place via bang method' do h1.deep_merge!(h2) h1.should == expected_hash end + end |