Created
December 10, 2013 16:18
-
-
Save jeregrine/7893318 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule PostgrexBugTest do | |
| use ExUnit.Case, async: false | |
| setup_all do | |
| { :ok, pid } = Postgrex.Connection.start_link([hostname: "localhost", username: "postgres", password: "postgres", database: "postgrex"]) | |
| Postgrex.Connection.query!(pid, "CREATE TABLE items(id serial primary key, value text, created timestamp default CURRENT_TIMESTAMP)") | |
| {:ok, [pid: pid]} | |
| end | |
| teardown_all context do | |
| Postgrex.Connection.query(context[:pid], "DROP TABLE items") | |
| :ok | |
| end | |
| test "the parenthesis on insert breaking everything", context do | |
| Postgrex.Connection.query!(context[:pid], "INSERT INTO items(value) VALUES('hello world') RETURNING (id)") | |
| end | |
| test "the parenthesis with multiple return on insert breaking everything", context do | |
| Postgrex.Connection.query!(context[:pid], "INSERT INTO items(value) VALUES('hello world') RETURNING (id, created)") | |
| end | |
| test "single return on insert does not", context do | |
| Postgrex.Connection.query!(context[:pid], "INSERT INTO items(value) VALUES('hello world') RETURNING id") | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment