From d166a36b471cf3eceadfb9d9e7c384be1a5784e0 Mon Sep 17 00:00:00 2001 From: Martin Frost Date: Mon, 10 Aug 2015 21:57:49 +0200 Subject: [PATCH] Update dependencies Bump postgrex up to `~> 0.9` and ecto to `~> 0.15` --- mix.exs | 12 ++++++------ mix.lock | 6 +++--- test/isn_test.exs | 16 ++++++++-------- test/test_helper.exs | 15 ++++++++++----- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/mix.exs b/mix.exs index d410f5d..3399644 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Isn.Mixfile do use Mix.Project - @version "0.1.0" + @version "0.1.1" def project do [app: :isn, @@ -23,7 +23,7 @@ defmodule Isn.Mixfile do # # Type `mix help compile.app` for more information def application do - [] + [applications: [:postgrex]] end defp description do @@ -40,9 +40,9 @@ defmodule Isn.Mixfile do end defp deps do - [{:postgrex, "~> 0.8.1"}, - {:ecto, "~> 0.11.0"}, - {:eh, "~> 0.2.0"}, - {:ex_doc, "~> 0.6.1", only: :dev}] + [{:postgrex, "~> 0.9"}, + {:ecto, "~> 0.15"}, + {:eh, "~> 0.2", only: :dev}, + {:ex_doc, "~> 0.8", only: :dev}] end end diff --git a/mix.lock b/mix.lock index 0c4f07c..4805079 100644 --- a/mix.lock +++ b/mix.lock @@ -1,6 +1,6 @@ %{"decimal": {:hex, :decimal, "1.1.0"}, - "ecto": {:hex, :ecto, "0.11.0"}, + "ecto": {:hex, :ecto, "0.15.0"}, "eh": {:hex, :eh, "0.2.0"}, - "ex_doc": {:hex, :ex_doc, "0.6.2"}, + "ex_doc": {:hex, :ex_doc, "0.8.0"}, "poolboy": {:hex, :poolboy, "1.5.1"}, - "postgrex": {:hex, :postgrex, "0.8.1"}} + "postgrex": {:hex, :postgrex, "0.9.1"}} diff --git a/test/isn_test.exs b/test/isn_test.exs index 3998b71..56ca0a5 100644 --- a/test/isn_test.exs +++ b/test/isn_test.exs @@ -10,42 +10,42 @@ defmodule IsnTest do end test "encode and decode isbn", context do - assert [{"1-937785-58-0"}] = + assert [["1-937785-58-0"]] = query(context[:pid], "SELECT $1::isbn", ['1937785580']) end test "encode and decode isbn13", context do - assert [{"978-1-937785-58-1"}] = + assert [["978-1-937785-58-1"]] = query(context[:pid], "SELECT $1::isbn13", ['9781937785581']) end test "encode and decode ismn", context do - assert [{"M-060-11561-5"}] = + assert [["M-060-11561-5"]] = query(context[:pid], "SELECT $1::ismn", ['9790060115615']) end test "encode and decode ismn13", context do - assert [{"979-0-060-11561-5"}] = + assert [["979-0-060-11561-5"]] = query(context[:pid], "SELECT $1::ismn13", ['9790060115615']) end test "encode and decode issn", context do - assert [{"1436-4522"}] = + assert [["1436-4522"]] = query(context[:pid], "SELECT $1::issn", ['14364522']) end test "encode and decode issn13", context do - assert [{"977-1436-452-00-8"}] = + assert [["977-1436-452-00-8"]] = query(context[:pid], "SELECT issn13(issn('1436-4522'))", []) end test "encode and decode ean13", context do - assert [{"022-035648348-1"}] = + assert [["022-035648348-1"]] = query(context[:pid], "SELECT $1::ean13", ["0220356483481"]) end test "encode and decode upc", context do - assert [{"220356483481"}] = + assert [["220356483481"]] = query(context[:pid], "SELECT $1::upc", ["220356483481"]) end end diff --git a/test/test_helper.exs b/test/test_helper.exs index 1ac6e95..88bfbac 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -21,8 +21,11 @@ ExUnit.start() defmodule Isn.TestHelper do def conn_options do db_options = [ + sync_connect: true, hostname: "localhost", - database: "isn_test"] + database: "isn_test", + username: "postgres", + password: ""] db_user = System.get_env("DATABASE_POSTGRESQL_USERNAME") db_pass = System.get_env("DATABASE_POSTGRESQL_PASSWORD") @@ -35,10 +38,10 @@ defmodule Isn.TestHelper do defmacro query(pid, statement, params) do quote bind_quoted: [pid: pid, statement: statement, params: params] do - case Postgrex.Connection.query(pid, statement, params, []) do - {:ok, %Postgrex.Result{rows: nil}} -> :ok - {:ok, %Postgrex.Result{rows: rows}} -> rows - {:error, %Postgrex.Error{} = err} -> err + case Postgrex.Connection.query!(pid, statement, params, []) do + %Postgrex.Result{rows: nil} -> :ok + %Postgrex.Result{rows: rows} -> rows + %Postgrex.Error{} = err -> err end end end @@ -49,5 +52,7 @@ db_options = Keyword.merge(Isn.TestHelper.conn_options, [database: "postgres"]) Postgrex.Connection.query!(pid, "DROP DATABASE IF EXISTS isn_test;", []) Postgrex.Connection.query!(pid, "CREATE DATABASE isn_test;", []) +Postgrex.Connection.stop(pid) {:ok, pid} = Postgrex.Connection.start_link(Isn.TestHelper.conn_options) Postgrex.Connection.query!(pid, "CREATE EXTENSION isn;", []) +Postgrex.Connection.stop(pid)