diff options
author | Ken Ip <ken.ip@pushpulllabs.com> | 2014-08-27 09:10:40 -0400 |
---|---|---|
committer | Ken Ip <ken.ip@pushpulllabs.com> | 2014-08-27 09:10:40 -0400 |
commit | 3a983b0e919635db6192bf17b18504badd778787 (patch) | |
tree | 7377114e813ea1b274ac984421548081a9edd9e0 | |
parent | c4fec2152c030000b0a80754dd8f8da15b65012e (diff) | |
download | hashie-3a983b0e919635db6192bf17b18504badd778787.tar.gz |
Add a test to prevent Mash from losing indifferent_access of nested hash
See discussion at https://github.com/intridea/hashie/pull/197
-rw-r--r-- | spec/hashie/mash_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb index 6579d00..4f80a51 100644 --- a/spec/hashie/mash_spec.rb +++ b/spec/hashie/mash_spec.rb @@ -71,6 +71,16 @@ describe Hashie::Mash do expect(subject.abc('foobar')).to eq 123 end + # Added due to downstream gems assuming indifferent access to be true for Mash + # When this is not, bump major version so that downstream gems can target + # correct version and fix accordingly. + # See https://github.com/intridea/hashie/pull/197 + it 'maintains indifferent access when nested' do + subject[:a] = { b: 'c' } + expect(subject[:a][:b]).to eq 'c' + expect(subject[:a]['b']).to eq 'c' + end + it 'returns a Hashie::Mash when passed a bang method to a non-existenct key' do expect(subject.abc!.is_a?(Hashie::Mash)).to be_truthy end |