Sha256: 44eedb77d71f38f2eef4190df0d0e48903251031721b43e9e8e5e5b1d6d74c0f
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
# encoding: utf-8 $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')); $:.uniq! require 'test_helper' class I18nBackendHelpersTest < Test::Unit::TestCase def setup @backend = I18n::Backend::Simple.new end test "wind_keys" do hash = { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, :"i.a" => "j", "g.a" => "h"} expected = { :"a.b.c" => "d", :"a.b.e" => "f", :"a.g" => "h", :"i.a" => "j", :"g.a" => "h" } assert_equal expected, @backend.wind_keys(hash) end test "unwind_keys" do hash = { "a.b.c" => "d", :"a.b.e" => "f", :"a.g" => "h", "i" => "j" } expected = { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"} assert_equal expected, @backend.unwind_keys(hash) end test "deep_symbolize_keys" do result = @backend.deep_symbolize_keys('foo' => { 'bar' => { 'baz' => 'bar' } }) expected = {:foo => {:bar => {:baz => 'bar'}}} assert_equal expected, result end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
i18n-0.3.6 | test/backend/helpers_test.rb |
i18n-0.3.6.pre | test/backend/helpers_test.rb |