Skip to content

Commit

Permalink
update tests, #30
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Feb 4, 2019
1 parent a6b0dd9 commit be5e833
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/all_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ defmodule AlogTest.AllTest do
test "does not include old items" do
{:ok, user} = %User{} |> User.changeset(Helpers.user_1_params()) |> User.insert()
{:ok, _} = %User{} |> User.changeset(Helpers.user_2_params()) |> User.insert()
{:ok, user_updated} = user |> User.changeset(%{postcode: "W2 3EC"}) |> User.update()
{:ok, _} = user |> User.changeset(%{postcode: "W2 3EC"}) |> User.update()

assert length(User.all()) == 2
assert user.inserted_at == user_updated.inserted_at
end

test "all return inserted_at original value" do
{:ok, user} = %User{} |> User.changeset(Helpers.user_1_params()) |> User.insert()
{:ok, user_updated} = user |> User.changeset(%{postcode: "W2 3EC"}) |> User.update()

[user_all] = User.all()
assert user_all.inserted_at == user.inserted_at
assert user_all.postcode == user_updated.postcode
end
end
end

0 comments on commit be5e833

Please sign in to comment.