From ce03e7d991a703c8d2e9c721902f312ccaeb5123 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 3 Mar 2018 21:25:29 +0200 Subject: Fix occurrences Fixnum|Bignum Related to https://github.com/rails/rails/commit/d4eb0dc89ee6b476e2e10869dc282a96f956c6c7#r27830891 --- actionview/test/template/date_helper_test.rb | 6 +++--- activerecord/test/cases/migration_test.rb | 6 ++---- activerecord/test/cases/numeric_data_test.rb | 14 ++++---------- .../test/migrations/decimal/1_give_me_big_numbers.rb | 2 +- activerecord/test/schema/schema.rb | 2 +- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index 94357d5f90..4b4939d705 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -141,10 +141,10 @@ class DateHelperTest < ActionView::TestCase end 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#/" + rubinius_skip "Date is written in Ruby and relies on Integer#/" + jruby_skip "Date is written in Ruby and relies on Integer#/" - # Make sure that we avoid {Integer,Fixnum}#/ (redefined by mathn) + # Make sure that we avoid Integer#/ (redefined by mathn) Integer.send :private, :/ from = Time.utc(2004, 6, 6, 21, 45, 0) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index c241ddc807..f77a275544 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -177,7 +177,7 @@ class MigrationTest < ActiveRecord::TestCase assert BigNumber.create( bank_balance: 1586.43, big_bank_balance: BigDecimal("1000234000567.95"), - world_population: 6000000000, + world_population: 2**62, my_house_population: 3, value_of_e: BigDecimal("2.7182818284590452353602875") ) @@ -191,10 +191,8 @@ class MigrationTest < ActiveRecord::TestCase assert_not_nil b.my_house_population assert_not_nil b.value_of_e - # TODO: set world_population >= 2**62 to cover 64-bit platforms and test - # is_a?(Bignum) assert_kind_of Integer, b.world_population - assert_equal 6000000000, b.world_population + assert_equal 2**62, b.world_population assert_kind_of Integer, b.my_house_population assert_equal 3, b.my_house_population assert_kind_of BigDecimal, b.bank_balance diff --git a/activerecord/test/cases/numeric_data_test.rb b/activerecord/test/cases/numeric_data_test.rb index f917c8f727..14db63890e 100644 --- a/activerecord/test/cases/numeric_data_test.rb +++ b/activerecord/test/cases/numeric_data_test.rb @@ -19,7 +19,7 @@ class NumericDataTest < ActiveRecord::TestCase m = NumericData.new( bank_balance: 1586.43, big_bank_balance: BigDecimal("1000234000567.95"), - world_population: 6000000000, + world_population: 2**62, my_house_population: 3 ) assert m.save @@ -27,11 +27,8 @@ class NumericDataTest < ActiveRecord::TestCase m1 = NumericData.find(m.id) assert_not_nil m1 - # As with migration_test.rb, we should make world_population >= 2**62 - # to cover 64-bit platforms and test it is a Bignum, but the main thing - # is that it's an Integer. assert_kind_of Integer, m1.world_population - assert_equal 6000000000, m1.world_population + assert_equal 2**62, m1.world_population assert_kind_of Integer, m1.my_house_population assert_equal 3, m1.my_house_population @@ -47,7 +44,7 @@ class NumericDataTest < ActiveRecord::TestCase m = NumericData.new( bank_balance: 1586.43122334, big_bank_balance: BigDecimal("234000567.952344"), - world_population: 6000000000, + world_population: 2**62, my_house_population: 3 ) assert m.save @@ -55,11 +52,8 @@ class NumericDataTest < ActiveRecord::TestCase m1 = NumericData.find(m.id) assert_not_nil m1 - # As with migration_test.rb, we should make world_population >= 2**62 - # to cover 64-bit platforms and test it is a Bignum, but the main thing - # is that it's an Integer. assert_kind_of Integer, m1.world_population - assert_equal 6000000000, m1.world_population + assert_equal 2**62, m1.world_population assert_kind_of Integer, m1.my_house_population assert_equal 3, m1.my_house_population diff --git a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb index b892f50e41..7d4233fe31 100644 --- a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +++ b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb @@ -5,7 +5,7 @@ class GiveMeBigNumbers < ActiveRecord::Migration::Current create_table :big_numbers do |table| table.column :bank_balance, :decimal, precision: 10, scale: 2 table.column :big_bank_balance, :decimal, precision: 15, scale: 2 - table.column :world_population, :decimal, precision: 10 + table.column :world_population, :decimal, precision: 20 table.column :my_house_population, :decimal, precision: 2 table.column :value_of_e, :decimal end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 3f4fe16678..8b0106dbf0 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -547,7 +547,7 @@ ActiveRecord::Schema.define do create_table :numeric_data, force: true do |t| t.decimal :bank_balance, precision: 10, scale: 2 t.decimal :big_bank_balance, precision: 15, scale: 2 - t.decimal :world_population, precision: 10, scale: 0 + t.decimal :world_population, precision: 20, scale: 0 t.decimal :my_house_population, precision: 2, scale: 0 t.decimal :decimal_number_with_default, precision: 3, scale: 2, default: 2.78 t.float :temperature -- cgit v1.2.3