Class: I18nExceptionsTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/vendor/i18n/test/i18n_exceptions_test.rb

Instance Method Summary collapse

Instance Method Details

#test_invalid_locale_messageObject



16
17
18
19
20
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 16

def test_invalid_locale_message
  force_invalid_locale
rescue I18n::ArgumentError => e
  assert_equal 'nil is not a valid locale', e.message
end

#test_invalid_locale_stores_localeObject



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_messageObject



44
45
46
47
48
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 44

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

#test_invalid_pluralization_data_stores_entry_and_countObject



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_messageObject



57
58
59
60
61
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 57

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

#test_missing_interpolation_argument_stores_key_and_stringObject



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_messageObject



31
32
33
34
35
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 31

def test_missing_translation_data_message
  force_missing_translation_data
rescue I18n::ArgumentError => e
  assert_equal 'translation missing: de, bar, foo', e.message
end

#test_missing_translation_data_stores_locale_key_and_optionsObject



22
23
24
25
26
27
28
29
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 22

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

#test_reserved_interpolation_key_messageObject



70
71
72
73
74
# File 'lib/vendor/i18n/test/i18n_exceptions_test.rb', line 70

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

#test_reserved_interpolation_key_stores_key_and_stringObject



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