forked from code-corps/code-corps-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomment_test.exs
More file actions
32 lines (26 loc) · 855 Bytes
/
comment_test.exs
File metadata and controls
32 lines (26 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
defmodule CodeCorps.CommentTest do
use CodeCorps.ModelCase
alias CodeCorps.Comment
@valid_attrs %{markdown: "I love elixir!", state: "published"}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = Comment.changeset(%Comment{}, @valid_attrs)
assert changeset.valid?
end
test "changeset with invalid attributes" do
changeset = Comment.changeset(%Comment{}, @invalid_attrs)
refute changeset.valid?
end
test "create changeset with valid attributes" do
attrs =
@valid_attrs
|> Map.put(:task_id, 1)
|> Map.put(:user_id, 1)
changeset = Comment.create_changeset(%Comment{}, attrs)
assert changeset.valid?
end
test "create changeset with invalid attributes" do
changeset = Comment.create_changeset(%Comment{}, @invalid_attrs)
refute changeset.valid?
end
end