Sha256: a493018ee1211801b977deac00d07d90109b6199643128ed2860857e13bbfaee
Contents?: true
Size: 856 Bytes
Versions: 11
Compression:
Stored size: 856 Bytes
Contents
describe Hash do context '#supermerge' do it 'should complain unless two hashes are passed to it' do expect { {}.supermerge('y') }.to raise_error(RuntimeError) end it 'should merge two simple hashes' do expect({ a: 'x' }.supermerge(b: 'y')).to eq(a: 'x', b: 'y') end it 'should merge two hashes both with arrays at the same key' do expect({ a: ['x'] }.supermerge(a: ['y'])).to eq(a: %w(x y)) end it 'should merge an array and a value at the same key' do expect({ a: 'x' }.supermerge(a: ['y'])).to eq(a: %w(x y)) end it 'should replace a value at the same key' do expect({ a: 'x' }.supermerge(a: 'y')).to eq(a: 'y') end it 'should merge two subhashes at the same key' do expect({ a: { b: 'x' } }.supermerge(a: { c: 'y' })).to eq(a: { b: 'x', c: 'y' }) end end end
Version data entries
11 entries across 11 versions & 1 rubygems