Skip to content

Commit dc44fa2

Browse files
committed
[Rails5] Coerce DefaultNumbersTest for before type cast.
1 parent 9cb96d7 commit dc44fa2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,3 +638,22 @@ def test_schema_dump_includes_datetime_precision_coerced
638638
assert_match %r{t\.datetime2\s+"updated_at",\s+precision: 6,\s+null: false$}, output
639639
end
640640
end
641+
642+
643+
644+
645+
class DefaultNumbersTest < ActiveRecord::TestCase
646+
# We do better with native types and do not return strings for everything.
647+
coerce_tests! :test_default_positive_integer
648+
def test_default_positive_integer_coerced
649+
record = DefaultNumber.new
650+
assert_equal 7, record.positive_integer
651+
assert_equal 7, record.positive_integer_before_type_cast
652+
end
653+
coerce_tests! :test_default_negative_integer
654+
def test_default_negative_integer_coerced
655+
record = DefaultNumber.new
656+
assert_equal -5, record.negative_integer
657+
assert_equal -5, record.negative_integer_before_type_cast
658+
end
659+
end

0 commit comments

Comments
 (0)