Sha256: edb47e9a8bb16d537c2305336c9a59dd147d359a9fa2cbce53292f7566609bee

Contents?: true

Size: 1.03 KB

Versions: 26

Compression:

Stored size: 1.03 KB

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 "#slice non-existent key" do
    hash = { :foo => 'bar',  :baz => 'bar' }
    expected = { :foo => 'bar' }
    assert_equal expected, hash.slice(:foo, :not_here)
  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

26 entries across 24 versions & 7 rubygems

Version Path
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/i18n-0.9.5/test/core_ext/hash_test.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/i18n-0.9.5/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/i18n-1.1.1/test/core_ext/hash_test.rb
i18n-1.1.1 test/core_ext/hash_test.rb
i18n-1.1.0 test/core_ext/hash_test.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/i18n-1.0.1/test/core_ext/hash_test.rb
i18n-1.0.1 test/core_ext/hash_test.rb