aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-05-30 11:37:15 -0400
committerGitHub <noreply@github.com>2017-05-30 11:37:15 -0400
commiteb804ad5a783e1e97720ef55a91b6aae7ebd724f (patch)
treee32658ae078a16b0ec1f144e6662f4f82af4572d
parent53c8dff33b2d68a9824efd19f431bb0e5f64d23a (diff)
parentba84867549a2bb5c1d3cb0bec8cf9f41e46f6d74 (diff)
downloadrails-eb804ad5a783e1e97720ef55a91b6aae7ebd724f.tar.gz
rails-eb804ad5a783e1e97720ef55a91b6aae7ebd724f.tar.bz2
rails-eb804ad5a783e1e97720ef55a91b6aae7ebd724f.zip
Merge pull request #29187 from robin850/remove-mathn
Remove requirement on mathn
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock2
-rw-r--r--actionview/test/template/date_helper_test.rb14
3 files changed, 11 insertions, 9 deletions
diff --git a/Gemfile b/Gemfile
index 8260533cb5..2a1b9fa7ef 100644
--- a/Gemfile
+++ b/Gemfile
@@ -154,7 +154,3 @@ end
gem "ibm_db" if ENV["IBM_DB"]
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "wdm", ">= 0.1.0", platforms: [:mingw, :mswin, :x64_mingw, :mswin64]
-
-platforms :ruby_25 do
- gem "mathn"
-end
diff --git a/Gemfile.lock b/Gemfile.lock
index e6640a116b..d08ddaf1b4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -209,7 +209,6 @@ GEM
nokogiri (>= 1.5.9)
mail (2.6.5)
mime-types (>= 1.16, < 4)
- mathn (0.1.0)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (3.1)
@@ -400,7 +399,6 @@ DEPENDENCIES
kindlerb (~> 1.2.0)
libxml-ruby
listen (>= 3.0.5, < 3.2)
- mathn
minitest (< 5.3.4)
mocha (~> 0.14)
mysql2 (>= 0.4.4)
diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb
index a259752d6a..b667303318 100644
--- a/actionview/test/template/date_helper_test.rb
+++ b/actionview/test/template/date_helper_test.rb
@@ -138,11 +138,19 @@ class DateHelperTest < ActionView::TestCase
assert_equal "10 minutes", distance_of_time_in_words(Time.at(600), 0)
end
- def test_distance_in_words_with_mathn_required
- # test we avoid Integer#/ (redefined by mathn)
- silence_warnings { require "mathn" }
+ def test_distance_in_words_doesnt_use_the_quotient_operator
+ rubinius_skip "Date is written in Ruby and relies on Fixnum#/"
+ jruby_skip "Date is written in Ruby and relies on Fixnum#/"
+
+ klass = RUBY_VERSION > "2.4" ? Integer : Fixnum
+
+ # Make sure that we avoid {Integer,Fixnum}#/ (redefined by mathn)
+ klass.send :private, :/
+
from = Time.utc(2004, 6, 6, 21, 45, 0)
assert_distance_of_time_in_words(from)
+ ensure
+ klass.send :public, :/
end
def test_time_ago_in_words_passes_include_seconds