Permalink
Browse files

Merge pull request #11771 from atambo/jruby_assert_distance_of_time_i…

…n_words

Remove privatizing of Fixnum#/ from assert_distance_of_time_in_words
  • Loading branch information...
2 parents ee0a8e0 + f1d9179 commit fd4e178c7ea571b3885e1247f438eead070a656e @rafaelfranca rafaelfranca committed Aug 6, 2013
Showing with 7 additions and 5 deletions.
  1. +7 −5 actionview/test/template/date_helper_test.rb
View
12 actionview/test/template/date_helper_test.rb
@@ -19,8 +19,6 @@ def to_param
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,16 +121,20 @@ def assert_distance_of_time_in_words(from, to=nil)
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
from = Time.utc(2004, 6, 6, 21, 45, 0)
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)

0 comments on commit fd4e178

Please sign in to comment.