April 2018
Beginner to intermediate
406 pages
9h 33m
English
Next, we can move on to actually writing our tests. We'll want to test two things, specifically:
We'll start with a test to cover the first scenario, since that should be pretty simple to write:
test "list_most_recent_polls/2 returns polls ordered by the most recent first", %{user: user} do poll = poll_fixture(%{user_id: user.id}) poll2 = poll_fixture(%{user_id: user.id}) poll3 = poll_fixture(%{user_id: user.id}) assert Votes.list_most_recent_polls() == [poll3, poll2, poll]end
What ...