Skip to content

Commit

Permalink
chore: compare decimals so the test works with mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed May 28, 2024
1 parent a80252f commit 7144589
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion integration_test/sql/subquery.exs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ defmodule Ecto.Integration.SubQueryTest do

query = from p in Post, as: :p, select: sum(p.visits), group_by: exists(from p in Post, where: p.visits > parent_as(:p).visits), order_by: [sum(p.visits)]

assert [11, 20] = TestRepo.all(query)
query
|> TestRepo.all()
|> Enum.map(&Decimal.new/1)
|> Enum.zip([Decimal.new(11), Decimal.new(20)])
|> Enum.all?(fn {a, b} -> Decimal.eq?(a, b) end)
|> assert()
end
end

0 comments on commit 7144589

Please sign in to comment.