Class: I18nSimpleBackendLocalizeDateTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nSimpleBackendLocalizeDateTest
show all
- Includes:
- I18nSimpleBackendTestSetup
- Defined in:
- lib/vendor/i18n/test/simple_backend_test.rb
Instance Method Summary
collapse
#add_datetime_translations, #backend_get_translations, #setup_backend
Instance Method Details
#setup ⇒ Object
312
313
314
315
316
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 312
def setup
@backend = I18n::Backend::Simple.new
add_datetime_translations
@date = Date.new 2008, 1, 1
end
|
#test_localize_nil_raises_argument_error ⇒ Object
354
355
356
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 354
def test_localize_nil_raises_argument_error
assert_raises(I18n::ArgumentError) { @backend.localize 'de', nil }
end
|
#test_localize_object_raises_argument_error ⇒ Object
358
359
360
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 358
def test_localize_object_raises_argument_error
assert_raises(I18n::ArgumentError) { @backend.localize 'de', Object.new }
end
|
330
331
332
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 330
def test_translate_given_a_day_name_format_it_returns_a_day_name
assert_equal 'Dienstag', @backend.localize('de', @date, '%A')
end
|
338
339
340
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 338
def test_translate_given_a_month_name_format_it_returns_a_month_name
assert_equal 'Januar', @backend.localize('de', @date, '%B')
end
|
334
335
336
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 334
def test_translate_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name
assert_equal 'Di', @backend.localize('de', @date, '%a')
end
|
342
343
344
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 342
def test_translate_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name
assert_equal 'Jan', @backend.localize('de', @date, '%b')
end
|
350
351
352
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 350
def test_translate_given_an_unknown_format_it_does_not_fail
assert_nothing_raised{ @backend.localize 'de', @date, '%x' }
end
|
346
347
348
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 346
def test_translate_given_no_format_it_does_not_fail
assert_nothing_raised{ @backend.localize 'de', @date }
end
|
326
327
328
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 326
def test_translate_given_the_default_format_it_uses_it
assert_equal '01.01.2008', @backend.localize('de', @date, :default)
end
|
322
323
324
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 322
def test_translate_given_the_long_format_it_uses_it
assert_equal '01. Januar 2008', @backend.localize('de', @date, :long)
end
|
318
319
320
|
# File 'lib/vendor/i18n/test/simple_backend_test.rb', line 318
def test_translate_given_the_short_format_it_uses_it
assert_equal '01. Jan', @backend.localize('de', @date, :short)
end
|