This commit is contained in:
parent
8c4ec2e59a
commit
3733b614ea
2 changed files with 16 additions and 3 deletions
|
@ -21,7 +21,11 @@ defmodule Exmr.ExamsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "create_exam/1 with valid data creates a exam" do
|
test "create_exam/1 with valid data creates a exam" do
|
||||||
valid_attrs = %{date: ~D[2024-11-13], description: "some description", subject: "some subject"}
|
valid_attrs = %{
|
||||||
|
date: ~D[2024-11-13],
|
||||||
|
description: "some description",
|
||||||
|
subject: "some subject"
|
||||||
|
}
|
||||||
|
|
||||||
assert {:ok, %Exam{} = exam} = Exams.create_exam(valid_attrs)
|
assert {:ok, %Exam{} = exam} = Exams.create_exam(valid_attrs)
|
||||||
assert exam.date == ~D[2024-11-13]
|
assert exam.date == ~D[2024-11-13]
|
||||||
|
@ -35,7 +39,12 @@ defmodule Exmr.ExamsTest do
|
||||||
|
|
||||||
test "update_exam/2 with valid data updates the exam" do
|
test "update_exam/2 with valid data updates the exam" do
|
||||||
exam = exam_fixture()
|
exam = exam_fixture()
|
||||||
update_attrs = %{date: ~D[2024-11-14], description: "some updated description", subject: "some updated subject"}
|
|
||||||
|
update_attrs = %{
|
||||||
|
date: ~D[2024-11-14],
|
||||||
|
description: "some updated description",
|
||||||
|
subject: "some updated subject"
|
||||||
|
}
|
||||||
|
|
||||||
assert {:ok, %Exam{} = exam} = Exams.update_exam(exam, update_attrs)
|
assert {:ok, %Exam{} = exam} = Exams.update_exam(exam, update_attrs)
|
||||||
assert exam.date == ~D[2024-11-14]
|
assert exam.date == ~D[2024-11-14]
|
||||||
|
|
|
@ -5,7 +5,11 @@ defmodule ExmrWeb.ExamLiveTest do
|
||||||
import Exmr.ExamsFixtures
|
import Exmr.ExamsFixtures
|
||||||
|
|
||||||
@create_attrs %{date: "2024-11-13", description: "some description", subject: "some subject"}
|
@create_attrs %{date: "2024-11-13", description: "some description", subject: "some subject"}
|
||||||
@update_attrs %{date: "2024-11-14", description: "some updated description", subject: "some updated subject"}
|
@update_attrs %{
|
||||||
|
date: "2024-11-14",
|
||||||
|
description: "some updated description",
|
||||||
|
subject: "some updated subject"
|
||||||
|
}
|
||||||
@invalid_attrs %{date: nil, description: nil, subject: nil}
|
@invalid_attrs %{date: nil, description: nil, subject: nil}
|
||||||
|
|
||||||
defp create_exam(_) do
|
defp create_exam(_) do
|
||||||
|
|
Loading…
Reference in a new issue