Sha256: 1ab97c96f9e743a7f791f9c1dc41bd0cb49a972e9df043d1f14cf82c6634efcd

Contents?: true

Size: 879 Bytes

Versions: 43

Compression:

Stored size: 879 Bytes

Contents

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

class I18nCoreExtHashInterpolationTest < I18n::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

43 entries across 37 versions & 16 rubygems

Version Path
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
abaci-0.3.0 vendor/bundle/gems/i18n-0.7.0/test/core_ext/hash_test.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/test/core_ext/hash_test.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/i18n-0.6.11/test/core_ext/hash_test.rb