diff options
author | Ben Tucker <ben@btucker.net> | 2013-05-01 18:09:04 -0400 |
---|---|---|
committer | Ben Tucker <ben@btucker.net> | 2013-05-06 09:36:40 -0400 |
commit | 5a6d9d54917e1311a9aef78a82313c296d821150 (patch) | |
tree | 622f5071c08b24b3575797fc0ea2f36a27217cca /actionpack | |
parent | 9d7a748a5174224ead4d44aedc3849d1d1e37b18 (diff) | |
download | rails-5a6d9d54917e1311a9aef78a82313c296d821150.tar.gz rails-5a6d9d54917e1311a9aef78a82313c296d821150.tar.bz2 rails-5a6d9d54917e1311a9aef78a82313c296d821150.zip |
Merging in fix from #8222
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/date_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/date_helper_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 99aa144d3a..39b9a8d27c 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -112,7 +112,7 @@ module ActionView # english it would read better as about 80 years. minutes_with_offset = distance_in_minutes - minute_offset_for_leap_year remainder = (minutes_with_offset % 525600) - distance_in_years = (minutes_with_offset / 525600) + distance_in_years = (minutes_with_offset.div 525600) if remainder < 131400 locale.t(:about_x_years, :count => distance_in_years) elsif remainder < 394200 diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index e4f84f8dd7..50c7892ad0 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -19,6 +19,8 @@ class DateHelperTest < ActionView::TestCase end def assert_distance_of_time_in_words(from, to=nil) + Fixnum.send :private, :/ # test we avoid Integer#/ (redefined by mathn) + to ||= from # 0..1 with include_seconds @@ -96,6 +98,9 @@ class DateHelperTest < ActionView::TestCase # test to < from assert_equal "about 4 hours", distance_of_time_in_words(from + 4.hours, to) assert_equal "less than 20 seconds", distance_of_time_in_words(from + 19.seconds, to, true) + + ensure + Fixnum.send :public, :/ end def test_distance_in_words |