Sha256: d29052060750248abc5ec60db0c7f9e999e4332eb72ad9f146e2ff3fabbd4a48

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

describe Hash do
  describe 'deep_symbolize_keys' do
    it 'symbolizes keys on nested hashes' do
      hash     = { 'foo' => { 'bar' => 'bar' } }
      expected = { :foo  => { :bar  => 'bar' } }
      expect(hash.deep_symbolize_keys).to eq(expected)
    end

    it 'walks arrays' do
      hash     = { 'foo' => [{ 'bar' => 'bar', 'baz' => { 'buz' => 'buz' } }] }
      expected = { :foo  => [{ :bar  => 'bar', :baz  => { :buz  => 'buz' } }] }
      expect(hash.deep_symbolize_keys).to eq(expected)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hashr-2.0.1 spec/core_ext_spec.rb
hashr-2.0.0 spec/core_ext_spec.rb
hashr-2.0.0.rc2 spec/core_ext_spec.rb