diff options
author | Vincent Esche <vincent.esche@namics.com> | 2015-06-05 18:48:09 +0200 |
---|---|---|
committer | Vincent Esche <regexident@gmail.com> | 2015-06-08 02:01:54 +0200 |
commit | 489309af7ffd8b4fe02bd839924b319cba8aa318 (patch) | |
tree | 56a2667e2deef61ba389c9a1a8b219fe44bb65ee /spec/hashie/extensions/stringify_keys_spec.rb | |
parent | b7405dca6d8d03c1650083119215a6eaf4125d91 (diff) | |
download | hashie-489309af7ffd8b4fe02bd839924b319cba8aa318.tar.gz |
Fix bug (#303) preventing use of deep_merge/stringify_keys/symbolize_keys on extended singleton objects.
Diffstat (limited to 'spec/hashie/extensions/stringify_keys_spec.rb')
-rw-r--r-- | spec/hashie/extensions/stringify_keys_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/hashie/extensions/stringify_keys_spec.rb b/spec/hashie/extensions/stringify_keys_spec.rb index b0f8aa6..f5f78d8 100644 --- a/spec/hashie/extensions/stringify_keys_spec.rb +++ b/spec/hashie/extensions/stringify_keys_spec.rb @@ -80,6 +80,29 @@ describe Hashie::Extensions::StringifyKeys do include_examples 'stringify_keys!' end end + + context 'singleton methods' do + subject { Hash } + let(:object) { subject.new.merge(a: 1, b: { c: 2 }).extend(Hashie::Extensions::StringifyKeys) } + let(:expected_hash) { { 'a' => 1, 'b' => { 'c' => 2 } } } + + describe '.stringify_keys' do + it 'does not raise error' do + expect { object.stringify_keys } .not_to raise_error + end + it 'produces expected stringified hash' do + expect(object.stringify_keys).to eq(expected_hash) + end + end + describe '.stringify_keys!' do + it 'does not raise error' do + expect { object.stringify_keys! } .not_to raise_error + end + it 'produces expected stringified hash' do + expect(object.stringify_keys!).to eq(expected_hash) + end + end + end end describe Hashie do |