summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org>2014-08-27 09:36:36 -0400
committerDaniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org>2014-08-27 09:36:36 -0400
commit4da84a36c209d3ca2748c94e9c152293c00d99d7 (patch)
tree7377114e813ea1b274ac984421548081a9edd9e0
parentc4fec2152c030000b0a80754dd8f8da15b65012e (diff)
parent3a983b0e919635db6192bf17b18504badd778787 (diff)
downloadhashie-4da84a36c209d3ca2748c94e9c152293c00d99d7.tar.gz
Merge pull request #219 from kenips/bug/add_test_case_for_197
Add a test to prevent Mash from losing indifferent_access of nested hash
-rw-r--r--spec/hashie/mash_spec.rb10
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