1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
require 'spec_helper'
describe "#constructive_merge" do
it "merges hashes without clobbering" do
x = {'reviews' => {'user' => {}}}
y = {'reviews' => {'ratings' => {}}}
x.extend TablePrint::HashExtensions::ConstructiveMerge
x.constructive_merge(y).should == {'reviews' => {'user' => {}, 'ratings' => {}}}
end
end
describe "#constructive_merge!" do
it "merges hashes in place without clobbering" do
x = {'reviews' => {'user' => {}}}
y = {'reviews' => {'ratings' => {}}}
x.extend TablePrint::HashExtensions::ConstructiveMerge
x.constructive_merge!(y)
x.should == {'reviews' => {'user' => {}, 'ratings' => {}}}
end
end
|