Skip to content

Commit fffc849

Browse files
author
spicychickensauce
committed
Add snapshot test of join with values query
1 parent b5bb5bd commit fffc849

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

test/ecto/adapters/sqlite3/connection/join_test.exs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ defmodule Ecto.Adapters.SQLite3.Connection.JoinTest do
135135
end
136136
end
137137

138-
test "join with values is not supported" do
139-
assert_raise Ecto.QueryError, fn ->
140-
rows = [%{x: 1, y: 1}, %{x: 2, y: 2}]
141-
types = %{x: :integer, y: :integer}
138+
test "join with values" do
139+
rows = [%{x: 1, y: 1}, %{x: 2, y: 2}]
140+
types = %{x: :integer, y: :integer}
142141

142+
query =
143143
Schema
144144
|> join(
145145
:inner,
@@ -149,8 +149,11 @@ defmodule Ecto.Adapters.SQLite3.Connection.JoinTest do
149149
)
150150
|> select([p, q], {p.id, q.x})
151151
|> plan()
152-
|> all()
153-
end
152+
153+
assert ~s{SELECT s0."id", v1."x" FROM "schema" AS s0 } <>
154+
~s{INNER JOIN (WITH xxx(y, x) AS (VALUES (?,?),(?,?)) SELECT * FROM xxx) AS v1 } <>
155+
~s{ON (v1."x" = s0."x") AND (v1."y" = s0."y")} ==
156+
all(query)
154157
end
155158

156159
test "join with fragment" do

0 commit comments

Comments
 (0)