mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
18 lines
488 B
Elixir
18 lines
488 B
Elixir
defmodule AshPostgres.SubqueryTest do
|
|
use AshPostgres.RepoCase, async: false
|
|
|
|
alias AshPostgres.Test.Subquery.{Access, Child, Parent, Through}
|
|
|
|
test "joins are correctly wrapped in subqueries" do
|
|
{:ok, child} = Child.create(%{})
|
|
|
|
{:ok, parent} =
|
|
Parent.create(%{visible: true})
|
|
|
|
Access.create(%{parent_id: parent.id, email: "foo@bar.com"})
|
|
|
|
Through.create(%{parent_id: parent.id, child_id: child.id})
|
|
|
|
Child.read!(actor: %{email: "foo@bar.com"})
|
|
end
|
|
end
|