Sha256: 1940fb9cccc1bc5d9ce552ee40029e248fb38fb0f7bf429af7e94e451da69008

Contents?: true

Size: 885 Bytes

Versions: 266

Compression:

Stored size: 885 Bytes

Contents

require 'test_helper'
require 'i18n/core_ext/hash'

class I18nCoreExtHashInterpolationTest < Test::Unit::TestCase
  test "#deep_symbolize_keys" do
    hash = { 'foo' => { 'bar' => { 'baz' => 'bar' } } }
    expected = { :foo => { :bar => { :baz => 'bar' } } }
    assert_equal expected, hash.deep_symbolize_keys
  end

  test "#slice" do
    hash = { :foo => 'bar',  :baz => 'bar' }
    expected = { :foo => 'bar' }
    assert_equal expected, hash.slice(:foo)
  end

  test "#except" do
    hash = { :foo => 'bar',  :baz => 'bar' }
    expected = { :foo => 'bar' }
    assert_equal expected, hash.except(:baz)
  end

  test "#deep_merge!" do
    hash = { :foo => { :bar => { :baz => 'bar' } }, :baz => 'bar' }
    hash.deep_merge!(:foo => { :bar => { :baz => 'foo' } })

    expected = { :foo => { :bar => { :baz => 'foo' } }, :baz => 'bar' }
    assert_equal expected, hash
  end
end

Version data entries

266 entries across 236 versions & 47 rubygems

Version Path
sayso-i18n-0.5.0.001 test/core_ext/hash_test.rb
i18n-0.6.0 test/core_ext/hash_test.rb
i18n-0.6.0beta1 test/core_ext/hash_test.rb
i18n-0.5.0 test/core_ext/hash_test.rb
i18n-0.5.0beta3 test/core_ext/hash_test.rb
i18n-0.5.0beta2 test/core_ext/hash_test.rb