Sha256: 6ec2345aab30f28933ba05b4887a21d80b4e8e70ec54f5e2c9526088f72f61b5
Contents?: true
Size: 898 Bytes
Versions: 4
Compression:
Stored size: 898 Bytes
Contents
require 'spec_helper' require 'foreplay' 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
foreplay-0.11.1 | spec/lib/hash_spec.rb |
foreplay-0.11.0 | spec/lib/hash_spec.rb |
foreplay-0.10.3 | spec/lib/hash_spec.rb |
foreplay-0.10.2 | spec/lib/hash_spec.rb |