Class: I18nSimpleBackendStoreTranslationsTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nSimpleBackendStoreTranslationsTest
- Includes:
- Tests::Backend::Simple::Setup::Base
- Defined in:
- lib/vendor/i18n/test/backend/simple/translations_test.rb
Instance Method Summary collapse
- #test_deep_symbolize_keys_works ⇒ Object
-
#test_store_translations_adds_translations ⇒ Object
no, really :-).
- #test_store_translations_converts_keys_to_symbols ⇒ Object
- #test_store_translations_deep_merges_translations ⇒ Object
- #test_store_translations_forces_locale_to_sym ⇒ Object
Methods included from Tests::Backend::Simple::Setup::Base
Instance Method Details
#test_deep_symbolize_keys_works ⇒ Object
59 60 61 62 63 |
# File 'lib/vendor/i18n/test/backend/simple/translations_test.rb', line 59 def test_deep_symbolize_keys_works result = I18n.backend.send :deep_symbolize_keys, 'foo' => {'bar' => {'baz' => 'bar'}} expected = {:foo => {:bar => {:baz => 'bar'}}} assert_equal expected, result end |
#test_store_translations_adds_translations ⇒ Object
no, really :-)
37 38 39 40 |
# File 'lib/vendor/i18n/test/backend/simple/translations_test.rb', line 37 def test_store_translations_adds_translations # no, really :-) I18n.backend.store_translations :'en', :foo => 'bar' assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations end |
#test_store_translations_converts_keys_to_symbols ⇒ Object
53 54 55 56 57 |
# File 'lib/vendor/i18n/test/backend/simple/translations_test.rb', line 53 def test_store_translations_converts_keys_to_symbols # backend_reset_translations! I18n.backend.store_translations 'en', 'foo' => {'bar' => 'bar', 'baz' => 'baz'} assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations end |
#test_store_translations_deep_merges_translations ⇒ Object
42 43 44 45 46 |
# File 'lib/vendor/i18n/test/backend/simple/translations_test.rb', line 42 def test_store_translations_deep_merges_translations I18n.backend.store_translations :'en', :foo => {:bar => 'bar'} I18n.backend.store_translations :'en', :foo => {:baz => 'baz'} assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations end |
#test_store_translations_forces_locale_to_sym ⇒ Object
48 49 50 51 |
# File 'lib/vendor/i18n/test/backend/simple/translations_test.rb', line 48 def test_store_translations_forces_locale_to_sym I18n.backend.store_translations 'en', :foo => 'bar' assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations end |