File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
test/ecto/adapters/sqlite3/connection Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ defmodule Ecto.Adapters.SQLite3.Connection.BinaryUUIDTest do
2+ use ExUnit.Case , async: false
3+
4+ import Ecto.Query
5+ import Ecto.Adapters.SQLite3.TestHelpers
6+
7+ alias EctoSQLite3.Schemas.Schema
8+
9+ setup_all do
10+ Application . put_env ( :ecto_sqlite3 , :uuid_type , :binary )
11+ Application . put_env ( :ecto_sqlite3 , :binary_id_type , :binary )
12+
13+ on_exit ( fn ->
14+ Application . put_env ( :ecto_sqlite3 , :uuid_type , :string )
15+ Application . put_env ( :ecto_sqlite3 , :binary_id_type , :string )
16+ end )
17+ end
18+
19+ describe "select" do
20+ test "casting uuid" do
21+ query =
22+ Schema
23+ |> select ( [ ] , type ( ^ "601d74e4-a8d3-4b6e-8365-eddb4c893327" , Ecto.UUID ) )
24+ |> plan ( )
25+
26+ assert ~s{ SELECT ? FROM "schema" AS s0} == all ( query )
27+ end
28+
29+ test "casting binary_ids" do
30+ query =
31+ Schema
32+ |> select ( [ ] , type ( ^ "601d74e4-a8d3-4b6e-8365-eddb4c893327" , :binary_id ) )
33+ |> plan ( )
34+
35+ assert ~s{ SELECT ? FROM "schema" AS s0} == all ( query )
36+ end
37+ end
38+ end
You can’t perform that action at this time.
0 commit comments