Module: Tests::Backend::Api::Localization::DateTime
- Included in:
- I18nChainBackendApiLocalizeDateTimeTest, I18nFallbacksBackendApiLocalizeDateTimeTest, I18nPluralizationBackendApiLocalizeDateTimeTest, I18nSimpleBackendApiLocalizeDateTimeTest
- Defined in:
- lib/vendor/i18n/test/api/localization/date_time.rb
Instance Method Summary collapse
- #test_localize_given_a_day_name_format_it_returns_the_correct_day_name ⇒ Object
- #test_localize_given_a_format_specified_as_a_proc ⇒ Object
- #test_localize_given_a_format_specified_as_a_proc_with_additional_options ⇒ Object
- #test_localize_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator ⇒ Object
- #test_localize_given_a_month_name_format_it_returns_the_correct_month_name ⇒ Object
- #test_localize_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name ⇒ Object
-
#test_localize_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name ⇒ Object
TODO should be Mrz, shouldn’t it?.
- #test_localize_given_an_unknown_format_it_does_not_fail ⇒ Object
- #test_localize_given_no_format_it_does_not_fail ⇒ Object
-
#test_localize_given_the_default_format_it_uses_it ⇒ Object
TODO should be Mrz, shouldn’t it?.
- #test_localize_given_the_long_format_it_uses_it ⇒ Object
-
#test_localize_given_the_short_format_it_uses_it ⇒ Object
TODO should be Mrz, shouldn’t it?.
Instance Method Details
#test_localize_given_a_day_name_format_it_returns_the_correct_day_name ⇒ Object
22 23 24 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 22 def test_localize_given_a_day_name_format_it_returns_the_correct_day_name assert_equal 'Samstag', I18n.backend.localize('de', morning_datetime, '%A') end |
#test_localize_given_a_format_specified_as_a_proc ⇒ Object
44 45 46 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 44 def test_localize_given_a_format_specified_as_a_proc assert_equal '1ter März 2008, 06:00 Uhr', I18n.backend.localize('de', morning_datetime, :long_ordinalized) end |
#test_localize_given_a_format_specified_as_a_proc_with_additional_options ⇒ Object
48 49 50 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 48 def assert_equal '1ter März 2008, 06:00 Uhr (MEZ)', I18n.backend.localize('de', morning_datetime, :long_ordinalized, :timezone => 'MEZ') end |
#test_localize_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator ⇒ Object
39 40 41 42 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 39 def test_localize_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator assert_equal 'am', I18n.backend.localize('de', morning_datetime, '%p') assert_equal 'pm', I18n.backend.localize('de', evening_datetime, '%p') end |
#test_localize_given_a_month_name_format_it_returns_the_correct_month_name ⇒ Object
30 31 32 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 30 def test_localize_given_a_month_name_format_it_returns_the_correct_month_name assert_equal 'März', I18n.backend.localize('de', morning_datetime, '%B') end |
#test_localize_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name ⇒ Object
26 27 28 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 26 def test_localize_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name assert_equal 'Sa', I18n.backend.localize('de', morning_datetime, '%a') end |
#test_localize_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name ⇒ Object
TODO should be Mrz, shouldn’t it?
35 36 37 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 35 def test_localize_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name assert_equal 'Mar', I18n.backend.localize('de', morning_datetime, '%b') end |
#test_localize_given_an_unknown_format_it_does_not_fail ⇒ Object
56 57 58 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 56 def test_localize_given_an_unknown_format_it_does_not_fail assert_nothing_raised{ I18n.backend.localize 'de', morning_datetime, '%x' } end |
#test_localize_given_no_format_it_does_not_fail ⇒ Object
52 53 54 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 52 def test_localize_given_no_format_it_does_not_fail assert_nothing_raised{ I18n.backend.localize 'de', morning_datetime } end |
#test_localize_given_the_default_format_it_uses_it ⇒ Object
TODO should be Mrz, shouldn’t it?
18 19 20 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 18 def test_localize_given_the_default_format_it_uses_it assert_equal 'Sa, 01. Mar 2008 06:00:00 +0000', I18n.backend.localize('de', morning_datetime, :default) end |
#test_localize_given_the_long_format_it_uses_it ⇒ Object
13 14 15 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 13 def test_localize_given_the_long_format_it_uses_it assert_equal '01. März 2008 06:00', I18n.backend.localize('de', morning_datetime, :long) end |
#test_localize_given_the_short_format_it_uses_it ⇒ Object
TODO should be Mrz, shouldn’t it?
9 10 11 |
# File 'lib/vendor/i18n/test/api/localization/date_time.rb', line 9 def test_localize_given_the_short_format_it_uses_it assert_equal '01. Mar 06:00', I18n.backend.localize('de', morning_datetime, :short) end |