Skip to content

Commit

Permalink
Test duplicate record insert. Relates to #18
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga committed Dec 24, 2016
1 parent 231cb4d commit 1a9179c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/unit/adapter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ defmodule Ecto.Adapters.MnesiaTest do
assert updated_at
end

test "duplicate record" do
schema = %SellOffer{
id: 2,
loan_id: "hello"
}

assert {:ok, _res_schema} = schema
|> TestRepo.insert

assert_raise Ecto.ConstraintError, fn ->
schema
|> TestRepo.insert
end
end

test "changeset" do
changeset = %SellOffer{}
|> Ecto.Changeset.change([loan_id: "hello"])
Expand Down

0 comments on commit 1a9179c

Please sign in to comment.