Sha256: 802607087f6ff30f1c19c78b7e598a05bf3941030f3226c5ec51f1bb0599ad27

Contents?: true

Size: 555 Bytes

Versions: 1

Compression:

Stored size: 555 Bytes

Contents

require 'test_helper'

class CoreExtTest < Test::Unit::TestCase
  test 'deep_symbolize_keys walks arrays, too' do
    hash     = { 'foo' => [{ 'bar' => 'bar', 'baz' => { 'buz' => 'buz' } }] }
    expected = { :foo  => [{ :bar  => 'bar', :baz  => { :buz  => 'buz' } }] }
    assert_equal expected, hash.deep_symbolize_keys
  end

  test 'deep_symbolize_keys! replaces with deep_symbolize' do
    hash     = { 'foo' => { 'bar' => 'baz' } }
    expected = { :foo => { :bar => 'baz' } }
    hash.deep_symbolize_keys!
    assert_equal expected, hash
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hashr-0.0.20 test/core_ext_test.rb