@@ -77,9 +77,7 @@ def test_column_names_are_escaped_coerced
7777 assert_equal '[t]]]' , conn . quote_column_name ( 't]' )
7878 end
7979
80- # PENDING: [Rails5.x] Remove coerced tests and use simple symbol types..
81- # This test has a few problems. First, it would require that we use the
82- # `Type::SQLServer::BigInteger.new(limit: 8)` for the `world_population` attribute.
80+ # We do not have do the DecimalWithoutScale type.
8381 coerce_tests! :test_numeric_fields
8482 coerce_tests! :test_numeric_fields_with_scale
8583
@@ -212,6 +210,44 @@ def test_remove_column_with_multi_column_index_coerced
212210
213211
214212
213+ class MigrationTest < ActiveRecord ::TestCase
214+ # We do not have do the DecimalWithoutScale type.
215+ coerce_tests! :test_add_table_with_decimals
216+ def test_add_table_with_decimals_coerced
217+ Person . connection . drop_table :big_numbers rescue nil
218+ assert !BigNumber . table_exists?
219+ GiveMeBigNumbers . up
220+ BigNumber . reset_column_information
221+ assert BigNumber . create (
222+ :bank_balance => 1586.43 ,
223+ :big_bank_balance => BigDecimal ( "1000234000567.95" ) ,
224+ :world_population => 6000000000 ,
225+ :my_house_population => 3 ,
226+ :value_of_e => BigDecimal ( "2.7182818284590452353602875" )
227+ )
228+ b = BigNumber . first
229+ assert_not_nil b
230+ assert_not_nil b . bank_balance
231+ assert_not_nil b . big_bank_balance
232+ assert_not_nil b . world_population
233+ assert_not_nil b . my_house_population
234+ assert_not_nil b . value_of_e
235+ assert_kind_of BigDecimal , b . world_population
236+ assert_equal '6000000000.0' , b . world_population . to_s
237+ assert_kind_of Integer , b . my_house_population
238+ assert_equal 3 , b . my_house_population
239+ assert_kind_of BigDecimal , b . bank_balance
240+ assert_equal BigDecimal ( "1586.43" ) , b . bank_balance
241+ assert_kind_of BigDecimal , b . big_bank_balance
242+ assert_equal BigDecimal ( "1000234000567.95" ) , b . big_bank_balance
243+ GiveMeBigNumbers . down
244+ assert_raise ( ActiveRecord ::StatementInvalid ) { BigNumber . first }
245+ end
246+ end
247+
248+
249+
250+
215251class CoreTest < ActiveRecord ::TestCase
216252 # I think fixtures are useing the wrong time zone and the `:first`
217253 # `topics`.`bonus_time` attribute of 2005-01-30t15:28:00.00+01:00 is
0 commit comments