Class: I18nSimpleBackendLoadTranslationsTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nSimpleBackendLoadTranslationsTest
show all
- Includes:
- I18nSimpleBackendTestSetup
- Defined in:
- lib/vendor/i18n/test/simple_backend_test.rb
Instance Method Summary
collapse
#add_datetime_translations, #backend_get_translations, #setup_backend
Instance Method Details
#test_load_rb_loads_data_from_ruby_file ⇒ Object
496
497
498
499
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 496
def test_load_rb_loads_data_from_ruby_file
data = @backend.send :load_rb, "#{@locale_dir}/en.rb"
assert_equal({:'en-Ruby' => {:foo => {:bar => "baz"}}}, data)
end
|
#test_load_rb_loads_data_from_yaml_file ⇒ Object
501
502
503
504
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 501
def test_load_rb_loads_data_from_yaml_file
data = @backend.send :load_yml, "#{@locale_dir}/en.yml"
assert_equal({'en-Yaml' => {'foo' => {'bar' => 'baz'}}}, data)
end
|
506
507
508
509
510
511
512
513
514
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 506
def test_load_translations_loads_from_different_file_formats
@backend = I18n::Backend::Simple.new
@backend.load_translations "#{@locale_dir}/en.rb", "#{@locale_dir}/en.yml"
expected = {
:'en-Ruby' => {:foo => {:bar => "baz"}},
:'en-Yaml' => {:foo => {:bar => "baz"}}
}
assert_equal expected, backend_get_translations
end
|
#test_load_translations_with_ruby_file_type_does_not_raise_exception ⇒ Object
492
493
494
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 492
def test_load_translations_with_ruby_file_type_does_not_raise_exception
assert_nothing_raised { @backend.load_translations "#{@locale_dir}/en.rb" }
end
|
#test_load_translations_with_unknown_file_type_raises_exception ⇒ Object
488
489
490
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 488
def test_load_translations_with_unknown_file_type_raises_exception
assert_raises(I18n::UnknownFileType) { @backend.load_translations "#{@locale_dir}/en.xml" }
end
|