Class: I18nSimpleBackendLocalizeDateTimeTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- I18nSimpleBackendLocalizeDateTimeTest
show all
- Includes:
- I18nSimpleBackendTestSetup
- Defined in:
- lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb
Instance Method Summary
collapse
#add_datetime_translations, #backend_get_translations, #setup_backend
Instance Method Details
365
366
367
368
369
370
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 365
def setup
@backend = I18n::Backend::Simple.new
add_datetime_translations
@morning = DateTime.new 2008, 1, 1, 6
@evening = DateTime.new 2008, 1, 1, 18
end
|
384
385
386
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 384
def test_translate_given_a_day_name_format_it_returns_the_correct_day_name
assert_equal 'Dienstag', @backend.localize('de', @morning, '%A')
end
|
400
401
402
403
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 400
def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator
assert_equal 'am', @backend.localize('de', @morning, '%p')
assert_equal 'pm', @backend.localize('de', @evening, '%p')
end
|
392
393
394
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 392
def test_translate_given_a_month_name_format_it_returns_the_correct_month_name
assert_equal 'Januar', @backend.localize('de', @morning, '%B')
end
|
388
389
390
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 388
def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name
assert_equal 'Di', @backend.localize('de', @morning, '%a')
end
|
396
397
398
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 396
def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name
assert_equal 'Jan', @backend.localize('de', @morning, '%b')
end
|
409
410
411
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 409
def test_translate_given_an_unknown_format_it_does_not_fail
assert_nothing_raised{ @backend.localize 'de', @morning, '%x' }
end
|
405
406
407
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 405
def test_translate_given_no_format_it_does_not_fail
assert_nothing_raised{ @backend.localize 'de', @morning }
end
|
380
381
382
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 380
def test_translate_given_the_default_format_it_uses_it
assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default)
end
|
376
377
378
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 376
def test_translate_given_the_long_format_it_uses_it
assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long)
end
|
372
373
374
|
# File 'lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb', line 372
def test_translate_given_the_short_format_it_uses_it
assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short)
end
|