Skip to content

Commit

Permalink
Coerce test
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed Sep 27, 2024
1 parent 6afe0cf commit bcd620f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,18 @@ def test_insert_all_returns_requested_sql_fields_coerced
result = Book.insert_all! [{ name: "Rework", author_id: 1 }], returning: Arel.sql("UPPER(INSERTED.name) as name")
assert_equal %w[ REWORK ], result.pluck("name")
end

# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
coerce_tests! :test_insert_with_type_casting_and_serialize_is_consistent
def test_insert_with_type_casting_and_serialize_is_consistent_coerced
connection.remove_index(:books, column: [:author_id, :name])

original_test_insert_with_type_casting_and_serialize_is_consistent
ensure
Book.where(author_id: nil, name: 'Array').delete_all
Book.lease_connection.add_index(:books, [:author_id, :name], unique: true)
end

end

module ActiveRecord
Expand Down

0 comments on commit bcd620f

Please sign in to comment.