summaryrefslogtreecommitdiff
path: root/spec/hashie/extensions/stringify_keys_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/hashie/extensions/stringify_keys_spec.rb')
-rw-r--r--spec/hashie/extensions/stringify_keys_spec.rb23
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