Module: Tests::Backend::Api::Localization::Date
- Included in:
- I18nChainBackendApiLocalizeDateTest, I18nFallbacksBackendApiLocalizeDateTest, I18nPluralizationBackendApiLocalizeDateTest, I18nSimpleBackendApiLocalizeDateTest
- Defined in:
- lib/vendor/i18n/test/api/localization/date.rb
Instance Method Summary collapse
- #test_localize_given_a_day_name_format_it_returns_a_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_month_name_format_it_returns_a_month_name ⇒ Object
- #test_localize_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name ⇒ Object
-
#test_localize_given_an_abbr_month_name_format_it_returns_an_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
- #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?.
- #test_localize_nil_raises_argument_error ⇒ Object
- #test_localize_object_raises_argument_error ⇒ Object
Instance Method Details
#test_localize_given_a_day_name_format_it_returns_a_day_name ⇒ Object
21 22 23 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 21 def test_localize_given_a_day_name_format_it_returns_a_day_name assert_equal 'Samstag', I18n.backend.localize('de', date, '%A') end |
#test_localize_given_a_format_specified_as_a_proc ⇒ Object
38 39 40 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 38 def test_localize_given_a_format_specified_as_a_proc assert_equal '1ter März 2008', I18n.backend.localize('de', date, :long_ordinalized) end |
#test_localize_given_a_format_specified_as_a_proc_with_additional_options ⇒ Object
42 43 44 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 42 def assert_equal '1ter März 2008 (MEZ)', I18n.backend.localize('de', date, :long_ordinalized, :timezone => 'MEZ') end |
#test_localize_given_a_month_name_format_it_returns_a_month_name ⇒ Object
29 30 31 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 29 def test_localize_given_a_month_name_format_it_returns_a_month_name assert_equal 'März', I18n.backend.localize('de', date, '%B') end |
#test_localize_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name ⇒ Object
25 26 27 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 25 def test_localize_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name assert_equal 'Sa', I18n.backend.localize('de', date, '%a') end |
#test_localize_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name ⇒ Object
TODO should be Mrz, shouldn’t it?
34 35 36 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 34 def test_localize_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name assert_equal 'Mar', I18n.backend.localize('de', date, '%b') end |
#test_localize_given_an_unknown_format_it_does_not_fail ⇒ Object
50 51 52 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 50 def test_localize_given_an_unknown_format_it_does_not_fail assert_nothing_raised{ I18n.backend.localize 'de', date, '%x' } end |
#test_localize_given_no_format_it_does_not_fail ⇒ Object
46 47 48 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 46 def test_localize_given_no_format_it_does_not_fail assert_nothing_raised{ I18n.backend.localize 'de', date } end |
#test_localize_given_the_default_format_it_uses_it ⇒ Object
17 18 19 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 17 def test_localize_given_the_default_format_it_uses_it assert_equal '01.03.2008', I18n.backend.localize('de', date, :default) end |
#test_localize_given_the_long_format_it_uses_it ⇒ Object
13 14 15 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 13 def test_localize_given_the_long_format_it_uses_it assert_equal '01. März 2008', I18n.backend.localize('de', date, :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.rb', line 9 def test_localize_given_the_short_format_it_uses_it assert_equal '01. Mar', I18n.backend.localize('de', date, :short) end |
#test_localize_nil_raises_argument_error ⇒ Object
54 55 56 |
# File 'lib/vendor/i18n/test/api/localization/date.rb', line 54 def test_localize_nil_raises_argument_error assert_raises(I18n::ArgumentError) { I18n.backend.localize 'de', nil } end |