Skip to content

Commit bcd620f

Browse files
committed
Coerce test
1 parent 6afe0cf commit bcd620f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,18 @@ def test_insert_all_returns_requested_sql_fields_coerced
24872487
result = Book.insert_all! [{ name: "Rework", author_id: 1 }], returning: Arel.sql("UPPER(INSERTED.name) as name")
24882488
assert_equal %w[ REWORK ], result.pluck("name")
24892489
end
2490+
2491+
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2492+
coerce_tests! :test_insert_with_type_casting_and_serialize_is_consistent
2493+
def test_insert_with_type_casting_and_serialize_is_consistent_coerced
2494+
connection.remove_index(:books, column: [:author_id, :name])
2495+
2496+
original_test_insert_with_type_casting_and_serialize_is_consistent
2497+
ensure
2498+
Book.where(author_id: nil, name: 'Array').delete_all
2499+
Book.lease_connection.add_index(:books, [:author_id, :name], unique: true)
2500+
end
2501+
24902502
end
24912503

24922504
module ActiveRecord

0 commit comments

Comments
 (0)