Class: I18nSimpleBackendPluralizeTest

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

Instance Method Summary collapse

Methods included from I18nSimpleBackendTestSetup

#add_datetime_translations, #backend_get_translations, #setup_backend

Instance Method Details

#test_interpolate_given_incomplete_pluralization_data_raises_invalid_pluralization_dataObject



232
233
234
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 232

def test_interpolate_given_incomplete_pluralization_data_raises_invalid_pluralization_data
  assert_raises(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, {:one => 'bar'}, 2) }
end

#test_pluralize_given_0_returns_plural_string_if_no_zero_key_givenObject



216
217
218
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 216

def test_pluralize_given_0_returns_plural_string_if_no_zero_key_given
  assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 0)
end

#test_pluralize_given_0_returns_zero_string_if_zero_key_givenObject



212
213
214
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 212

def test_pluralize_given_0_returns_zero_string_if_zero_key_given
  assert_equal 'zero', @backend.send(:pluralize, nil, {:zero => 'zero', :one => 'bar', :other => 'bars'}, 0)
end

#test_pluralize_given_1_returns_singular_stringObject



220
221
222
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 220

def test_pluralize_given_1_returns_singular_string
  assert_equal 'bar', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 1)
end

#test_pluralize_given_2_returns_plural_stringObject



224
225
226
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 224

def test_pluralize_given_2_returns_plural_string
  assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 2)
end

#test_pluralize_given_3_returns_plural_stringObject



228
229
230
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 228

def test_pluralize_given_3_returns_plural_string
  assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 3)
end

#test_pluralize_given_nil_returns_the_given_entryObject



207
208
209
210
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 207

def test_pluralize_given_nil_returns_the_given_entry
  entry = {:one => 'bar', :other => 'bars'}
  assert_equal entry, @backend.send(:pluralize, nil, entry, nil)
end