Sha256: edacd640fbff91c822f3153cdf30b49188f976abf9d4e4c19ad29e39c1721a72
Contents?: true
Size: 1.19 KB
Versions: 6
Compression:
Stored size: 1.19 KB
Contents
require 'grocer/extensions/deep_symbolize_keys' describe Grocer::Extensions::DeepSymbolizeKeys do let(:nested_strings) { { 'a' => { 'b' => { 'c' => 3 } } } } let(:nested_symbols) { { :a => { :b => { :c => 3 } } } } let(:nested_mixed) { { 'a' => { :b => { 'c' => 3 } } } } let(:nested_fixnums) { { 0 => { 1 => { 2 => 3} } } } let(:nested_illegal_symbols) { { [] => { [] => 3} } } before do nested_symbols.extend described_class nested_strings.extend described_class nested_mixed.extend described_class nested_fixnums.extend described_class nested_illegal_symbols.extend described_class end it 'does not change nested symbols' do nested_symbols.deep_symbolize_keys.should == nested_symbols end it 'symbolizes nested strings' do nested_strings.deep_symbolize_keys.should == nested_symbols end it 'symbolizes a mix of nested strings and symbols' do nested_mixed.deep_symbolize_keys.should == nested_symbols end it 'preserves fixnum keys' do nested_fixnums.deep_symbolize_keys.should == nested_fixnums end it 'preserves keys that cannot be symbolized' do nested_illegal_symbols.deep_symbolize_keys.should == nested_illegal_symbols end end
Version data entries
6 entries across 6 versions & 1 rubygems