Class: I18nExceptionsTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nExceptionsTest
- Defined in:
- lib/vendor/i18n/test/i18n_exceptions_test.rb
Instance Method Summary collapse
- #test_invalid_locale_message ⇒ Object
- #test_invalid_locale_stores_locale ⇒ Object
- #test_invalid_pluralization_data_message ⇒ Object
- #test_invalid_pluralization_data_stores_entry_and_count ⇒ Object
- #test_missing_interpolation_argument_message ⇒ Object
- #test_missing_interpolation_argument_stores_key_and_string ⇒ Object
- #test_missing_translation_data_message ⇒ Object
- #test_missing_translation_data_stores_locale_key_and_options ⇒ Object
- #test_reserved_interpolation_key_message ⇒ Object
- #test_reserved_interpolation_key_stores_key_and_string ⇒ Object
Instance Method Details
#test_invalid_locale_message ⇒ Object
16 17 18 19 20 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 16 def force_invalid_locale rescue I18n::ArgumentError => e assert_equal 'nil is not a valid locale', e. end |
#test_invalid_locale_stores_locale ⇒ Object
10 11 12 13 14 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 10 def test_invalid_locale_stores_locale force_invalid_locale rescue I18n::ArgumentError => e assert_nil e.locale end |
#test_invalid_pluralization_data_message ⇒ Object
44 45 46 47 48 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 44 def force_invalid_pluralization_data rescue I18n::ArgumentError => e assert_equal 'translation data [:bar] can not be used with :count => 1', e. end |
#test_invalid_pluralization_data_stores_entry_and_count ⇒ Object
37 38 39 40 41 42 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 37 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 |
#test_missing_interpolation_argument_message ⇒ Object
57 58 59 60 61 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 57 def force_missing_interpolation_argument rescue I18n::ArgumentError => e assert_equal 'interpolation argument bar missing in "{{bar}}"', e. end |
#test_missing_interpolation_argument_stores_key_and_string ⇒ Object
50 51 52 53 54 55 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 50 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 |
#test_missing_translation_data_message ⇒ Object
31 32 33 34 35 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 31 def force_missing_translation_data rescue I18n::ArgumentError => e assert_equal 'translation missing: de, bar, foo', e. end |
#test_missing_translation_data_stores_locale_key_and_options ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 22 def force_missing_translation_data rescue I18n::ArgumentError => e = {:scope => :bar} assert_equal 'de', e.locale assert_equal :foo, e.key assert_equal , e. end |
#test_reserved_interpolation_key_message ⇒ Object
70 71 72 73 74 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 70 def force_reserved_interpolation_key rescue I18n::ArgumentError => e assert_equal 'reserved key "scope" used in "{{scope}}"', e. end |
#test_reserved_interpolation_key_stores_key_and_string ⇒ Object
63 64 65 66 67 68 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 63 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 |