aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-01-17 06:28:57 +0000
committerRick Olson <technoweenie@gmail.com>2007-01-17 06:28:57 +0000
commit4733182e566c87f5f351340f759ac84a265eb151 (patch)
tree33b2ffeb9e6d460e2fd09f7e455ee37d0992b064 /actionpack/test
parent1ff84503b4a6f1da1cee125d5f872d760b159ba2 (diff)
downloadrails-4733182e566c87f5f351340f759ac84a265eb151.tar.gz
rails-4733182e566c87f5f351340f759ac84a265eb151.tar.bz2
rails-4733182e566c87f5f351340f759ac84a265eb151.zip
Fix #distance_of_time_in_words to report accurately against the Duration class. #7114 [eventualbuddha]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5973 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rwxr-xr-xactionpack/test/template/date_helper_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb
index bd3ad09db8..ae0494628b 100755
--- a/actionpack/test/template/date_helper_test.rb
+++ b/actionpack/test/template/date_helper_test.rb
@@ -18,7 +18,7 @@ class DateHelperTest < Test::Unit::TestCase
end
def test_distance_in_words
- from = Time.mktime(2004, 3, 6, 21, 45, 0)
+ from = Time.mktime(2004, 6, 6, 21, 45, 0)
# 0..1 with include_seconds
assert_equal "less than 5 seconds", distance_of_time_in_words(from, from + 0.seconds, true)
@@ -64,16 +64,16 @@ class DateHelperTest < Test::Unit::TestCase
assert_equal "about 1 month", distance_of_time_in_words(from, from + 29.days + 23.hours + 59.minutes + 30.seconds)
assert_equal "about 1 month", distance_of_time_in_words(from, from + 59.days + 23.hours + 59.minutes + 29.seconds)
- # 86400..525959
+ # 86400..525599
assert_equal "2 months", distance_of_time_in_words(from, from + 59.days + 23.hours + 59.minutes + 30.seconds)
assert_equal "12 months", distance_of_time_in_words(from, from + 1.years - 31.seconds)
- # 525960..1051919
+ # 525600..1051199
assert_equal "about 1 year", distance_of_time_in_words(from, from + 1.years - 30.seconds)
assert_equal "about 1 year", distance_of_time_in_words(from, from + 2.years - 31.seconds)
- # > 1051920
- assert_equal "over 2 years", distance_of_time_in_words(from, from + 2.years - 30.seconds)
+ # > 1051199
+ assert_equal "over 2 years", distance_of_time_in_words(from, from + 2.years + 30.seconds)
assert_equal "over 10 years", distance_of_time_in_words(from, from + 10.years)
# test to < from