@@ -1395,7 +1395,7 @@ def test_schema_dump_keeps_large_precision_integer_columns_as_decimal_coerced
13951395 assert_match %r{t.decimal\s +"atoms_in_universe",\s +precision: 38} , output
13961396 end
13971397
1398- # This is a poorly written test and really does not catch the bottom'ness it is meant too . Ours throw it off.
1398+ # This is a poorly written test and really does not catch the bottom'ness it is meant to . Ours throw it off.
13991399 coerce_tests! :test_foreign_keys_are_dumped_at_the_bottom_to_circumvent_dependency_issues
14001400
14011401 # Fall through false positive with no filter.
@@ -1416,6 +1416,35 @@ def test_schema_dump_includes_decimal_options_coerced
14161416class SchemaDumperDefaultsTest < ActiveRecord ::TestCase
14171417 # These date formats do not match ours. We got these covered in our dumper tests.
14181418 coerce_tests! :test_schema_dump_defaults_with_universally_supported_types
1419+
1420+ # SQL Server uses different method to generate a UUID than Rails test uses. Reimplemented the
1421+ # test in 'SchemaDumperDefaultsCoerceTest'.
1422+ coerce_tests! :test_schema_dump_with_text_column
1423+ end
1424+
1425+ class SchemaDumperDefaultsCoerceTest < ActiveRecord ::TestCase
1426+ include SchemaDumpingHelper
1427+
1428+ setup do
1429+ @connection = ActiveRecord ::Base . connection
1430+ @connection . create_table :dump_defaults , force : true do |t |
1431+ t . string :string_with_default , default : "Hello!"
1432+ t . date :date_with_default , default : "2014-06-05"
1433+ t . datetime :datetime_with_default , default : "2014-06-05 07:17:04"
1434+ t . time :time_with_default , default : "07:17:04"
1435+ t . decimal :decimal_with_default , default : "1234567890.0123456789" , precision : 20 , scale : 10
1436+
1437+ t . text :text_with_default , default : "John' Doe"
1438+ t . text :uuid , default : -> { "newid()" }
1439+ end
1440+ end
1441+
1442+ def test_schema_dump_with_text_column_coerced
1443+ output = dump_table_schema ( "dump_defaults" )
1444+
1445+ assert_match %r{t\. text\s +"text_with_default",.*?default: "John' Doe"} , output
1446+ assert_match %r{t\. text\s +"uuid",.*?default: -> \{ "newid\( \) " \} } , output
1447+ end
14191448end
14201449
14211450class TestAdapterWithInvalidConnection < ActiveRecord ::TestCase
0 commit comments