Skip to content

Commit

Permalink
Merge remote-tracking branch 'ecto3-fork/smpallen99#394'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroslav Rogov committed Jun 18, 2020
2 parents 3839a79 + bbcb836 commit 58dd665
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 71 deletions.
1 change: 0 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ config :coherence, TestCoherenceWeb.Endpoint,
config :coherence, ecto_repos: [TestCoherence.Repo]

config :coherence, TestCoherence.Repo,
adapter: Ecto.Adapters.Postgres,
username: System.get_env("DB_USERNAME") || "postgres",
password: System.get_env("DB_PASSWORD") || "postgres",
database: "coherence_test",
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/coh.clean.ex
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ defmodule Mix.Tasks.Coh.Clean do

defp do_remove!(config, repo) do
ensure_repo(repo, [])
path = Path.relative_to(migrations_path(repo), Mix.Project.app_path())
path = Path.relative_to(Ecto.Migrator.migrations_path(repo), Mix.Project.app_path())

case Path.wildcard(path <> "/*coherence*") do
[] ->
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/coh.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ defmodule Mix.Tasks.Coh.Install do
path

_ ->
Path.relative_to(migrations_path(repo), Mix.Project.app_path())
Path.relative_to(Ecto.Migrator.migrations_path(repo), Mix.Project.app_path())
end

file = Path.join(path, "#{current_timestamp}_#{underscore(name)}.exs")
Expand Down
15 changes: 3 additions & 12 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,8 @@ defmodule Coherence.Mixfile do
def application do
[
mod: {Coherence, []},
applications: [
extra_applications: [
:logger,
:comeonin,
:ecto,
:elixir_uuid,
:phoenix_swoosh,
:timex_ecto,
:tzdata,
:plug,
:phoenix,
:phoenix_html
]
]
end
Expand All @@ -47,7 +38,8 @@ defmodule Coherence.Mixfile do

defp deps do
[
{:ecto, "~> 2.0"},
{:ecto, "~> 3.0"},
{:ecto_sql, "~> 3.0"},
{:comeonin, "~> 4.0"},
{:bcrypt_elixir, "~> 1.1"},
{:phoenix, "~> 1.3"},
Expand All @@ -56,7 +48,6 @@ defmodule Coherence.Mixfile do
{:elixir_uuid, "~> 1.2"},
{:phoenix_swoosh, "~> 0.2"},
{:timex, "~> 3.3"},
{:timex_ecto, "~> 3.3"},
{:floki, "~> 0.19", only: :test},
{:ex_doc, "~> 0.18.0", only: :dev},
{:earmark, "~> 1.2", only: :dev, override: true},
Expand Down
45 changes: 0 additions & 45 deletions mix.lock

This file was deleted.

2 changes: 1 addition & 1 deletion test/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ defmodule CoherenceTest.Schema do
assert cs.errors == [
password:
{"should be at least %{count} character(s)",
[count: 4, validation: :length, min: 4]}
[count: 4, validation: :length, kind: :min]}
]
end

Expand Down
2 changes: 1 addition & 1 deletion test/support/repo.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
defmodule TestCoherence.Repo do
use Ecto.Repo, otp_app: :coherence
use Ecto.Repo, otp_app: :coherence, adapter: Ecto.Adapters.Postgres
end
18 changes: 9 additions & 9 deletions test/support/schema.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule TestCoherence.User do
end

@required_fields ~w(email name)a
@optional_fields ~w() ++ coherence_fields()
@optional_fields coherence_fields() |> Enum.map(&String.to_atom(&1))

def changeset(model, params \\ %{}) do
model
Expand All @@ -28,7 +28,7 @@ defmodule TestCoherence.User do
model
|> cast(
params,
~w(password password_confirmation reset_password_token reset_password_sent_at)
~w(password password_confirmation reset_password_token reset_password_sent_at)a
)
|> validate_coherence_password_reset(params)
end
Expand Down Expand Up @@ -63,7 +63,7 @@ defmodule TestCoherence.Invitation do

def changeset(model, params \\ %{}) do
model
|> cast(params, ~w(name email token))
|> cast(params, ~w(name email token)a)
|> validate_required([:name, :email])
|> unique_constraint(:email)
|> validate_format(:email, ~r/@/)
Expand Down Expand Up @@ -98,7 +98,7 @@ defmodule TestCoherence.Account do
model
|> cast(
params,
~w(password password_confirmation reset_password_token reset_password_sent_at)
~w(password password_confirmation reset_password_token reset_password_sent_at)a
)
|> validate_coherence_password_reset(params)
end
Expand Down Expand Up @@ -134,7 +134,7 @@ defmodule TestCoherence.Coherence.User do
model
|> cast(
params,
~w(password password_confirmation reset_password_token reset_password_sent_at)
~w(password password_confirmation reset_password_token reset_password_sent_at)a
)
|> validate_coherence_password_reset(params)
end
Expand All @@ -155,7 +155,7 @@ defmodule TestCoherence.Coherence.Invitation do

def changeset(model, params \\ %{}) do
model
|> cast(params, ~w(name email token))
|> cast(params, ~w(name email token)a)
|> validate_required([:name, :email])
|> unique_constraint(:email)
|> validate_format(:email, ~r/@/)
Expand All @@ -180,7 +180,7 @@ defmodule TestCoherence.Coherence.Account do
end

@required_fields ~w(email name)a
@optional_fields ~w() ++ coherence_fields()
@optional_fields coherence_fields() |> Enum.map(&String.to_atom(&1))

def changeset(model, params \\ %{}) do
model
Expand All @@ -194,7 +194,7 @@ defmodule TestCoherence.Coherence.Account do
model
|> cast(
params,
~w(password password_confirmation reset_password_token reset_password_sent_at)
~w(password password_confirmation reset_password_token reset_password_sent_at)a
)
|> validate_coherence_password_reset(params)
end
Expand All @@ -220,7 +220,7 @@ defmodule TestCoherence.Coherence.Rememberable do

def changeset(model, params \\ %{}) do
model
|> cast(params, ~w(series_hash token_hash token_created_at user_id))
|> cast(params, ~w(series_hash token_hash token_created_at user_id)a)
|> validate_required(~w(series_hash token_hash token_created_at user_id)a)
end

Expand Down

0 comments on commit 58dd665

Please sign in to comment.