diff options
Diffstat (limited to 'activesupport/test/i18n_test.rb')
-rw-r--r-- | activesupport/test/i18n_test.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb index 3faa15e7fd..7d88d2dc6b 100644 --- a/activesupport/test/i18n_test.rb +++ b/activesupport/test/i18n_test.rb @@ -1,6 +1,6 @@ -require 'abstract_unit' -require 'active_support/time' -require 'active_support/core_ext/array/conversions' +require "abstract_unit" +require "active_support/time" +require "active_support/core_ext/array/conversions" class I18nTest < ActiveSupport::TestCase def setup @@ -18,15 +18,15 @@ class I18nTest < ActiveSupport::TestCase end def test_date_localization_with_default_format - assert_equal @date.strftime("%Y-%m-%d"), I18n.localize(@date, :format => :default) + assert_equal @date.strftime("%Y-%m-%d"), I18n.localize(@date, format: :default) end def test_date_localization_with_short_format - assert_equal @date.strftime("%b %d"), I18n.localize(@date, :format => :short) + assert_equal @date.strftime("%b %d"), I18n.localize(@date, format: :short) end def test_date_localization_with_long_format - assert_equal @date.strftime("%B %d, %Y"), I18n.localize(@date, :format => :long) + assert_equal @date.strftime("%B %d, %Y"), I18n.localize(@date, format: :long) end def test_time_localization_should_use_default_format @@ -34,15 +34,15 @@ class I18nTest < ActiveSupport::TestCase end def test_time_localization_with_default_format - assert_equal @time.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(@time, :format => :default) + assert_equal @time.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(@time, format: :default) end def test_time_localization_with_short_format - assert_equal @time.strftime("%d %b %H:%M"), I18n.localize(@time, :format => :short) + assert_equal @time.strftime("%d %b %H:%M"), I18n.localize(@time, format: :short) end def test_time_localization_with_long_format - assert_equal @time.strftime("%B %d, %Y %H:%M"), I18n.localize(@time, :format => :long) + assert_equal @time.strftime("%B %d, %Y %H:%M"), I18n.localize(@time, format: :long) end def test_day_names @@ -66,39 +66,39 @@ class I18nTest < ActiveSupport::TestCase end def test_time_am - assert_equal 'am', I18n.translate(:'time.am') + assert_equal "am", I18n.translate(:'time.am') end def test_time_pm - assert_equal 'pm', I18n.translate(:'time.pm') + assert_equal "pm", I18n.translate(:'time.pm') end def test_words_connector - assert_equal ', ', I18n.translate(:'support.array.words_connector') + assert_equal ", ", I18n.translate(:'support.array.words_connector') end def test_two_words_connector - assert_equal ' and ', I18n.translate(:'support.array.two_words_connector') + assert_equal " and ", I18n.translate(:'support.array.two_words_connector') end def test_last_word_connector - assert_equal ', and ', I18n.translate(:'support.array.last_word_connector') + assert_equal ", and ", I18n.translate(:'support.array.last_word_connector') end def test_to_sentence default_two_words_connector = I18n.translate(:'support.array.two_words_connector') default_last_word_connector = I18n.translate(:'support.array.last_word_connector') - assert_equal 'a, b, and c', %w[a b c].to_sentence - I18n.backend.store_translations 'en', :support => { :array => { :two_words_connector => ' & ' } } - assert_equal 'a & b', %w[a b].to_sentence - I18n.backend.store_translations 'en', :support => { :array => { :last_word_connector => ' and ' } } - assert_equal 'a, b and c', %w[a b c].to_sentence + assert_equal "a, b, and c", %w[a b c].to_sentence + I18n.backend.store_translations "en", support: { array: { two_words_connector: " & " } } + assert_equal "a & b", %w[a b].to_sentence + I18n.backend.store_translations "en", support: { array: { last_word_connector: " and " } } + assert_equal "a, b and c", %w[a b c].to_sentence ensure - I18n.backend.store_translations 'en', :support => { :array => { :two_words_connector => default_two_words_connector } } - I18n.backend.store_translations 'en', :support => { :array => { :last_word_connector => default_last_word_connector } } + I18n.backend.store_translations "en", support: { array: { two_words_connector: default_two_words_connector } } + I18n.backend.store_translations "en", support: { array: { last_word_connector: default_last_word_connector } } end def test_to_sentence_with_empty_i18n_store - assert_equal 'a, b, and c', %w[a b c].to_sentence(locale: 'empty') + assert_equal "a, b, and c", %w[a b c].to_sentence(locale: "empty") end end |