Connection lost
Reconnecting. If you just saved something, check that it saved before trying again.
Server error
Reconnecting to the server. If you just saved something, check that it saved before trying again.
Generating multiple test cases from a single test in Elixir using a for-comprehension!
0 comments
🧪 TIL: You can generate multiple test cases from a single test in Elixir using a for-comprehension! Super clean way to test similar scenarios.
for status <- [:active, :archived, :close, :delete, :draft, :planned, :public] do
@tag status: status
test "filters courses by status: #{status}", %{status: status} do
%MyApp.Course{id: course_id} = course_fixture(%{status: status})
assert {:ok, [course_from_db]} = MyApp.Course.list_courses(status)
assert course_from_db.id == course_id
end
end
7 tests, 1 block of code! 🎯
Credits to Jeff Sandberg. Read more here.