Class: 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
12 13 14 15 16 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 12 def force_invalid_locale rescue I18n::ArgumentError => e assert_equal 'nil is not a valid locale', e. end |
#test_invalid_locale_stores_locale ⇒ Object
6 7 8 9 10 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 6 def test_invalid_locale_stores_locale force_invalid_locale rescue I18n::ArgumentError => e assert_nil e.locale end |
#test_invalid_pluralization_data_message ⇒ Object
40 41 42 43 44 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 40 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
33 34 35 36 37 38 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 33 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
54 55 56 57 58 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 54 def force_missing_interpolation_argument rescue I18n::ArgumentError => e assert_equal 'missing interpolation argument in "{{bar}}" ({:baz=>"baz"} given)', e. end |
#test_missing_interpolation_argument_stores_key_and_string ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 46 def test_missing_interpolation_argument_stores_key_and_string assert_raises(I18n::MissingInterpolationArgument) { force_missing_interpolation_argument } 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
27 28 29 30 31 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 27 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
18 19 20 21 22 23 24 25 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 18 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
67 68 69 70 71 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 67 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
60 61 62 63 64 65 |
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 60 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 |