Class: I18nSimpleBackendStoreTranslationsTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
Tests::Backend::Simple::Setup::Base
Defined in:
lib/vendor/i18n/test/backend/simple/translations_test.rb

Instance Method Summary collapse

Methods included from Tests::Backend::Simple::Setup::Base

#setup, #teardown

Instance Method Details

#test_deep_symbolize_keys_worksObject



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_translationsObject

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_symbolsObject



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_translationsObject



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_symObject



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