We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db24c6a commit d58b8ffCopy full SHA for d58b8ff
test/blog/accounts/accounts_test.exs
@@ -0,0 +1,18 @@
1
+defmodule Blog.AccountsTest do
2
+ use Blog.DataCase
3
+
4
+ alias Blog.Accounts
5
6
+ test "create_user/1 returns {:error, changeset} and rolles back transaction on error" do
7
+ attrs = %{
8
+ contact: %{type: "phone", value: "+1 000 000 0000"},
9
+ name: "",
10
+ password: "password"
11
+ }
12
13
+ contact_count = Repo.aggregate(Accounts.Contact, :count, :id)
14
15
+ assert {:error, %Ecto.Changeset{}} = Accounts.create_user(attrs)
16
+ assert ^contact_count = Repo.aggregate(Accounts.Contact, :count, :id)
17
+ end
18
+end
0 commit comments