@@ -879,15 +879,15 @@ def test_relations_dont_load_all_records_in_inspect_coerced
879879 # so we are skipping all together.
880880 coerce_tests! :test_empty_complex_chained_relations
881881
882- # Can't apply offset withour ORDER
882+ # Can't apply offset without ORDER
883883 coerce_tests! %r{using a custom table affects the wheres}
884884 test 'using a custom table affects the wheres coerced' do
885885 post = posts ( :welcome )
886886
887887 assert_equal post , custom_post_relation . where! ( title : post . title ) . order ( :id ) . take
888888 end
889889
890- # Can't apply offset withour ORDER
890+ # Can't apply offset without ORDER
891891 coerce_tests! %r{using a custom table with joins affects the joins}
892892 test 'using a custom table with joins affects the joins coerced' do
893893 post = posts ( :welcome )
@@ -1151,10 +1151,21 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
11511151
11521152
11531153
1154+ require "models/book"
11541155module ActiveRecord
11551156 class StatementCacheTest < ActiveRecord ::TestCase
11561157 # Getting random failures.
11571158 coerce_tests! :test_find_does_not_use_statement_cache_if_table_name_is_changed
1159+
1160+ # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1161+ coerce_tests! :test_statement_cache_values_differ
1162+ def test_statement_cache_values_differ_coerced
1163+ Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1164+
1165+ original_test_statement_cache_values_differ
1166+ ensure
1167+ Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1168+ end
11581169 end
11591170end
11601171
@@ -1264,3 +1275,47 @@ class DatabaseTasksTruncateAllTest < ActiveRecord::TestCase
12641275 coerce_tests! :test_truncate_tables
12651276 end
12661277end
1278+
1279+
1280+ require "models/book"
1281+ class EnumTest < ActiveRecord ::TestCase
1282+ # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1283+ coerce_tests! %r{enums are distinct per class}
1284+ test "enums are distinct per class coerced" do
1285+ Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1286+
1287+ send ( :'original_enums are distinct per class' )
1288+ ensure
1289+ Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1290+ end
1291+
1292+ # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1293+ coerce_tests! %r{creating new objects with enum scopes}
1294+ test "creating new objects with enum scopes coerced" do
1295+ Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1296+
1297+ send ( :'original_creating new objects with enum scopes' )
1298+ ensure
1299+ Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1300+ end
1301+
1302+ # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1303+ coerce_tests! %r{enums are inheritable}
1304+ test "enums are inheritable coerced" do
1305+ Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1306+
1307+ send ( :'original_enums are inheritable' )
1308+ ensure
1309+ Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1310+ end
1311+
1312+ # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
1313+ coerce_tests! %r{declare multiple enums at a time}
1314+ test "declare multiple enums at a time coerced" do
1315+ Book . connection . remove_index ( :books , column : [ :author_id , :name ] )
1316+
1317+ send ( :'original_declare multiple enums at a time' )
1318+ ensure
1319+ Book . connection . add_index ( :books , [ :author_id , :name ] , unique : true )
1320+ end
1321+ end
0 commit comments