diff options
author | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-11-09 11:33:47 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-11-09 11:33:47 -0800 |
commit | 0f1da1cb5cfac1343958daef4c5e7c37a9ce0da3 (patch) | |
tree | 428f88b698fb03f0bcddcb7017d16753b288e661 /activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb | |
parent | 4a1f43878105d701fd2dd769ec3cf7e81d133c09 (diff) | |
download | rails-0f1da1cb5cfac1343958daef4c5e7c37a9ce0da3.tar.gz rails-0f1da1cb5cfac1343958daef4c5e7c37a9ce0da3.tar.bz2 rails-0f1da1cb5cfac1343958daef4c5e7c37a9ce0da3.zip |
Revert "Bundle I18n 0.2.0."
This reverts commit 83f329f5f30567a10bc96410da230bf986db8ad4.
Diffstat (limited to 'activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb')
-rw-r--r-- | activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb new file mode 100644 index 0000000000..4e78e71b34 --- /dev/null +++ b/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb @@ -0,0 +1,99 @@ +$:.unshift "lib" + +require 'rubygems' +require 'test/unit' +require 'i18n' +require 'active_support' + +class I18nExceptionsTest < Test::Unit::TestCase + def test_invalid_locale_stores_locale + force_invalid_locale + rescue I18n::ArgumentError => e + assert_nil e.locale + end + + def test_invalid_locale_message + force_invalid_locale + rescue I18n::ArgumentError => e + assert_equal 'nil is not a valid locale', e.message + end + + def test_missing_translation_data_stores_locale_key_and_options + force_missing_translation_data + rescue I18n::ArgumentError => e + options = {:scope => :bar} + assert_equal 'de', e.locale + assert_equal :foo, e.key + assert_equal options, e.options + end + + def test_missing_translation_data_message + force_missing_translation_data + rescue I18n::ArgumentError => e + assert_equal 'translation missing: de, bar, foo', e.message + end + + def test_invalid_pluralization_data_stores_entry_and_count + force_invalid_pluralization_data + rescue I18n::ArgumentError => e + assert_equal [:bar], e.entry + assert_equal 1, e.count + end + + def test_invalid_pluralization_data_message + force_invalid_pluralization_data + rescue I18n::ArgumentError => e + assert_equal 'translation data [:bar] can not be used with :count => 1', e.message + end + + def test_missing_interpolation_argument_stores_key_and_string + force_missing_interpolation_argument + rescue I18n::ArgumentError => e + assert_equal 'bar', e.key + assert_equal "{{bar}}", e.string + end + + def test_missing_interpolation_argument_message + force_missing_interpolation_argument + rescue I18n::ArgumentError => e + assert_equal 'interpolation argument bar missing in "{{bar}}"', e.message + end + + def test_reserved_interpolation_key_stores_key_and_string + force_reserved_interpolation_key + rescue I18n::ArgumentError => e + assert_equal 'scope', e.key + assert_equal "{{scope}}", e.string + end + + def test_reserved_interpolation_key_message + force_reserved_interpolation_key + rescue I18n::ArgumentError => e + assert_equal 'reserved key "scope" used in "{{scope}}"', e.message + end + + private + def force_invalid_locale + I18n.backend.translate nil, :foo + end + + def force_missing_translation_data + I18n.backend.store_translations 'de', :bar => nil + I18n.backend.translate 'de', :foo, :scope => :bar + end + + def force_invalid_pluralization_data + I18n.backend.store_translations 'de', :foo => [:bar] + I18n.backend.translate 'de', :foo, :count => 1 + end + + def force_missing_interpolation_argument + I18n.backend.store_translations 'de', :foo => "{{bar}}" + I18n.backend.translate 'de', :foo, :baz => 'baz' + end + + def force_reserved_interpolation_key + I18n.backend.store_translations 'de', :foo => "{{scope}}" + I18n.backend.translate 'de', :foo, :baz => 'baz' + end +end
\ No newline at end of file |