Skip to content

Commit

Permalink
add test for all, #40
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Mar 12, 2019
1 parent 53c92d1 commit d9eb8b9
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions test/all_test.exs
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
defmodule AlogTest.AllTest do
use Alog.TestApp.DataCase

# alias Alog.TestApp.{User, Helpers}
#
# describe "all/0:" do
# test "succeeds" do
# {:ok, _} = %User{} |> User.changeset(Helpers.user_1_params()) |> User.insert()
# {:ok, _} = %User{} |> User.changeset(Helpers.user_2_params()) |> User.insert()
#
# assert length(User.all()) == 2
# end
#
# 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 |> User.changeset(%{postcode: "W2 3EC"}) |> User.update()
#
# assert length(User.all()) == 2
# end
#
# test "all return inserted_at original value" do
# {:ok, user} = %User{} |> User.changeset(Helpers.user_3_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
alias Alog.TestApp.{Comment}

describe "all/0:" do
test "succeeds" do
{:ok, _comment} = %Comment{comment: "Hello Rob"} |> Repo.insert()
{:ok, _} = %Comment{comment: "Hello Dan"} |> Repo.insert()

assert length(Repo.all(Comment)) == 2
end
end
end

0 comments on commit d9eb8b9

Please sign in to comment.