aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/date_helper_i18n_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-08-22 12:44:14 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-22 12:44:14 -0700
commita6e05b18d65d07a157ee09d54167c81f3d1440f8 (patch)
treeb19158cbc1ede41fc5db61bb3877e0407457e22b /actionpack/test/template/date_helper_i18n_test.rb
parentab33b27947864d94be667db836e0ad7497575d13 (diff)
parentaad429a46e3017fa7ca73f58428693e821be42b6 (diff)
downloadrails-a6e05b18d65d07a157ee09d54167c81f3d1440f8.tar.gz
rails-a6e05b18d65d07a157ee09d54167c81f3d1440f8.tar.bz2
rails-a6e05b18d65d07a157ee09d54167c81f3d1440f8.zip
Merge commit 'sven/i18n' into i18n
Diffstat (limited to 'actionpack/test/template/date_helper_i18n_test.rb')
-rw-r--r--actionpack/test/template/date_helper_i18n_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/template/date_helper_i18n_test.rb b/actionpack/test/template/date_helper_i18n_test.rb
index 2b40074498..bf3b2588c8 100644
--- a/actionpack/test/template/date_helper_i18n_test.rb
+++ b/actionpack/test/template/date_helper_i18n_test.rb
@@ -47,6 +47,28 @@ class DateHelperDistanceOfTimeInWordsI18nTests < Test::Unit::TestCase
I18n.expects(:t).with(key, options)
distance_of_time_in_words(@from, to, include_seconds, :locale => 'en-US')
end
+
+ def test_distance_of_time_pluralizations
+ { [:'less_than_x_seconds', 1] => 'less than 1 second',
+ [:'less_than_x_seconds', 2] => 'less than 2 seconds',
+ [:'less_than_x_minutes', 1] => 'less than a minute',
+ [:'less_than_x_minutes', 2] => 'less than 2 minutes',
+ [:'x_minutes', 1] => '1 minute',
+ [:'x_minutes', 2] => '2 minutes',
+ [:'about_x_hours', 1] => 'about 1 hour',
+ [:'about_x_hours', 2] => 'about 2 hours',
+ [:'x_days', 1] => '1 day',
+ [:'x_days', 2] => '2 days',
+ [:'about_x_years', 1] => 'about 1 year',
+ [:'about_x_years', 2] => 'about 2 years',
+ [:'over_x_years', 1] => 'over 1 year',
+ [:'over_x_years', 2] => 'over 2 years'
+
+ }.each do |args, expected|
+ key, count = *args
+ assert_equal expected, I18n.t(key, :count => count, :scope => 'datetime.distance_in_words')
+ end
+ end
end
end