Sha256: d7b0775eb18a4b464862f705431912418817fe617f5d00e0ea6c0f6447737fe5
Contents?: true
Size: 952 Bytes
Versions: 2
Compression:
Stored size: 952 Bytes
Contents
# encoding: utf-8 require 'test/helper' describe 'Hash#symbolize_keys' do it 'should convert keys to symbols' do hash_old = { 'foo' => 'bar' } hash_new = { :foo => 'bar' } hash_old.symbolize_keys.must_equal hash_new end end describe 'Hash#stringify_keys' do it 'should leave strings as strings' do hash_old = { 'foo' => 'bar' } hash_new = { 'foo' => 'bar' } hash_old.stringify_keys.must_equal hash_new end it 'should convert symbols to strings' do hash_old = { :foo => 'bar' } hash_new = { 'foo' => 'bar' } hash_old.stringify_keys.must_equal hash_new end it 'should convert integers to strings' do hash_old = { 123 => 'bar' } hash_new = { '123' => 'bar' } hash_old.stringify_keys.must_equal hash_new end it 'should convert nil to an empty string' do hash_old = { nil => 'bar' } hash_new = { '' => 'bar' } hash_old.stringify_keys.must_equal hash_new end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc3-3.1.9 | test/base/core_ext/hash_spec.rb |
nanoc3-3.1.8 | test/base/core_ext/hash_spec.rb |