Skip to content

Commit

Permalink
So not make Fixnum#/ private on Ruby verions less than 1.9.3
Browse files Browse the repository at this point in the history
In those version to_date call Fixnum#/, what will cause a failure
  • Loading branch information
rafaelfranca committed May 10, 2013
1 parent a59d661 commit 0be27b7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions actionpack/test/template/date_helper_test.rb
Expand Up @@ -19,7 +19,7 @@ def to_param
end end


def assert_distance_of_time_in_words(from, to=nil) def assert_distance_of_time_in_words(from, to=nil)
Fixnum.send :private, :/ # test we avoid Integer#/ (redefined by mathn) Fixnum.send(:private, :/) if RUBY_VERSION >= '1.9.3' # test we avoid Integer#/ (redefined by mathn)


to ||= from to ||= from


Expand Down Expand Up @@ -98,9 +98,8 @@ def assert_distance_of_time_in_words(from, to=nil)
# test to < from # test to < from
assert_equal "about 4 hours", distance_of_time_in_words(from + 4.hours, to) 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) assert_equal "less than 20 seconds", distance_of_time_in_words(from + 19.seconds, to, true)

ensure
ensure Fixnum.send(:public, :/) if RUBY_VERSION >= '1.9.3'
Fixnum.send :public, :/
end end


def test_distance_in_words def test_distance_in_words
Expand Down

0 comments on commit 0be27b7

Please sign in to comment.