From c1af31e262f791f7a4d8fedf692f32e86880764c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:01:39 +0000 Subject: [PATCH] Coerce FieldOrderedValuesTest tests for SQL Server NULL uniqueness --- test/cases/coerced_tests.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/cases/coerced_tests.rb b/test/cases/coerced_tests.rb index 348856828..74fea7df4 100644 --- a/test/cases/coerced_tests.rb +++ b/test/cases/coerced_tests.rb @@ -2458,6 +2458,39 @@ def test_in_order_of_with_array_values_with_nil_coerced Book.where(author_id: nil, name: nil).delete_all Book.lease_connection.add_index(:books, [:author_id, :name], unique: true) end + + # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite. + coerce_tests! :test_in_order_of_with_out_of_bound_integer_does_not_match_nulls + def test_in_order_of_with_out_of_bound_integer_does_not_match_nulls_coerced + Book.lease_connection.remove_index(:books, column: [:author_id, :name]) + + original_test_in_order_of_with_out_of_bound_integer_does_not_match_nulls + ensure + Book.where(author_id: nil, name: nil).delete_all + Book.lease_connection.add_index(:books, [:author_id, :name], unique: true) + end + + # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite. + coerce_tests! :test_in_order_of_with_only_unrepresentable_values_does_not_build_empty_case + def test_in_order_of_with_only_unrepresentable_values_does_not_build_empty_case_coerced + Book.lease_connection.remove_index(:books, column: [:author_id, :name]) + + original_test_in_order_of_with_only_unrepresentable_values_does_not_build_empty_case + ensure + Book.where(author_id: nil, name: nil).delete_all + Book.lease_connection.add_index(:books, [:author_id, :name], unique: true) + end + + # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite. + coerce_tests! :test_in_order_of_with_unknown_enum_key_does_not_match_nulls + def test_in_order_of_with_unknown_enum_key_does_not_match_nulls_coerced + Book.lease_connection.remove_index(:books, column: [:author_id, :name]) + + original_test_in_order_of_with_unknown_enum_key_does_not_match_nulls + ensure + Book.where(author_id: nil, name: nil).delete_all + Book.lease_connection.add_index(:books, [:author_id, :name], unique: true) + end end class QueryLogsTest < ActiveRecord::TestCase