Update dependencies

Bump postgrex up to `~> 0.9` and ecto to `~> 0.15`
This commit is contained in:
Martin Frost 2015-08-10 21:57:49 +02:00
parent a4cddac199
commit d166a36b47
4 changed files with 27 additions and 22 deletions

12
mix.exs
View File

@ -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

View File

@ -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"}}

View File

@ -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

View File

@ -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)