Skip to content

Commit

Permalink
Merge pull request #11 from mitchellhenke/fix-warnings
Browse files Browse the repository at this point in the history
fix test warnings
  • Loading branch information
izelnakri authored Mar 15, 2017
2 parents 4f77c9f + fdf0dc2 commit d170675
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
3 changes: 3 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule PaperTrail.Mixfile do
description: description(),
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
elixirc_paths: elixirc_paths(Mix.env),
package: package(),
deps: deps()
]
Expand Down Expand Up @@ -50,4 +51,6 @@ defmodule PaperTrail.Mixfile do
}
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
end
22 changes: 22 additions & 0 deletions test/support/repo.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule PaperTrail.Repo do
use Ecto.Repo, otp_app: :paper_trail
end

defmodule User do
use Ecto.Schema

import Ecto.Changeset

schema "users" do
field :token, :string
field :username, :string

timestamps()
end

def changeset(model, params \\ %{}) do
model
|> cast(params, [:token, :username])
|> validate_required([:token, :username])
end
end
23 changes: 0 additions & 23 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
# TODO: strict_mode(check the current_version_id changes on next versions), Test error cases, producer_id, PaperTrail.insert_all

defmodule PaperTrail.Repo do
use Ecto.Repo, otp_app: :paper_trail
end

defmodule User do
use Ecto.Schema

import Ecto.Changeset

schema "users" do
field :token, :string
field :username, :string

timestamps()
end

def changeset(model, params \\ %{}) do
model
|> cast(params, [:token, :username])
|> validate_required([:token, :username])
end
end

Mix.Task.run "ecto.create", ~w(-r PaperTrail.Repo)
Mix.Task.run "ecto.migrate", ~w(-r PaperTrail.Repo)

Expand Down

0 comments on commit d170675

Please sign in to comment.