1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activemodel/test/cases
John Hawthorn 68926798a5
Fix invalid string Decimal casting under ruby 2.4
In Ruby 2.4, BigDecimal(), as used by the Decimal cast, was changed so
that it will raise ArgumentError when passed an invalid string, in order
to be more consistent with Integer(), Float(), etc. The other numeric
types use ex. to_i and to_f.

Unfortunately, we can't simply change BigDecimal() to to_d. String#to_d
raises errors like BigDecimal(), unlike all the other to_* methods (this
should probably be filed as a ruby bug).

Instead, this simulates the existing behaviour and the behaviour of the
other to_* methods by finding a numeric string at the start of the
passed in value, and parsing that using BigDecimal().

See also
https://bugs.ruby-lang.org/issues/10286
3081a627ce
2017-02-24 19:41:23 -05:00
..
serializers improve error message when include assertions fail 2016-09-16 12:03:37 -07:00
type Fix invalid string Decimal casting under ruby 2.4 2017-02-24 19:41:23 -05:00
validations Remove deprecated behavior that halts callbacks when the return is false 2017-02-07 12:19:37 -03:00
attribute_assignment_test.rb Describe what we are protecting 2016-12-23 23:48:54 +09:00
attribute_methods_test.rb Add three new rubocop rules 2016-08-16 04:30:11 -03:00
callbacks_test.rb Remove deprecated behavior that halts callbacks when the return is false 2017-02-07 12:19:37 -03:00
conversion_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
dirty_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
errors_test.rb Missing require for strip_heredoc 2017-01-17 03:47:31 +09:00
forbidden_attributes_protection_test.rb normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
helper.rb Remove ActiveModel::TestCase from lib 2017-02-07 07:46:52 +09:00
lint_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
model_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
naming_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
railtie_test.rb applies new string literal convention in activemodel/test 2016-08-06 18:38:23 +02:00
secure_password_test.rb "Use assert_nil if expecting nil. This will fail in minitest 6." 2016-12-25 02:29:52 +09:00
serialization_test.rb Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
translation_test.rb Add three new rubocop rules 2016-08-16 04:30:11 -03:00
validations_test.rb improve error message when include assertions fail 2016-09-16 12:03:37 -07:00