aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/date_helper_test.rb
diff options
context:
space:
mode:
authorAlex Tambellini <atambellini@gmail.com>2013-08-05 20:33:37 -0400
committerAlex Tambellini <atambellini@gmail.com>2013-08-05 21:52:13 -0400
commitf1d9179087a6206e4a896f3a866d69e82604bf6d (patch)
treed9fd6089c7318d0754228e2323cb10573e75cd27 /actionview/test/template/date_helper_test.rb
parentee0a8e01139896e3d65d2156046afe7f24f64cfe (diff)
downloadrails-f1d9179087a6206e4a896f3a866d69e82604bf6d.tar.gz
rails-f1d9179087a6206e4a896f3a866d69e82604bf6d.tar.bz2
rails-f1d9179087a6206e4a896f3a866d69e82604bf6d.zip
Remove privatizing of Fixnum#/ from assert_distance_of_time_in_words
MRI reimplemented Date in C so it doesn't hit this division anymore while JRuby still uses the old stdlib implementation of Date so it will always hit this. With this change the actionview date_helper_test.rb tests should pass on JRuby.
Diffstat (limited to 'actionview/test/template/date_helper_test.rb')
-rw-r--r--actionview/test/template/date_helper_test.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb
index 242b56a1fd..5f09aef249 100644
--- a/actionview/test/template/date_helper_test.rb
+++ b/actionview/test/template/date_helper_test.rb
@@ -19,8 +19,6 @@ 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 minute with :include_seconds => true
@@ -123,9 +121,6 @@ class DateHelperTest < ActionView::TestCase
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, :include_seconds => true)
assert_equal "less than a minute", distance_of_time_in_words(from + 19.seconds, to, :include_seconds => false)
-
- ensure
- Fixnum.send :public, :/
end
def test_distance_in_words
@@ -133,6 +128,13 @@ class DateHelperTest < ActionView::TestCase
assert_distance_of_time_in_words(from)
end
+ def test_distance_in_words_with_mathn_required
+ # test we avoid Integer#/ (redefined by mathn)
+ require 'mathn'
+ from = Time.utc(2004, 6, 6, 21, 45, 0)
+ assert_distance_of_time_in_words(from)
+ end
+
def test_time_ago_in_words_passes_include_seconds
assert_equal "less than 20 seconds", time_ago_in_words(15.seconds.ago, :include_seconds => true)
assert_equal "less than a minute", time_ago_in_words(15.seconds.ago, :include_seconds => false)