Understanding the code behind tests

When we start off creating our own controllers/views/etc, if we're not using a generator, we won't have any new logic or functionality to cover tests for the new code we’re writing. Due to this, if we just run mix test without any modifications, we'll see a few passing tests but nothing that actually covers our poll controller. The best place to start is right there, so we'll start off by implementing some tests to cover our dummy data poll response first. We'll create a new file under test/vocial_web/controllers/poll_controller_test.exs. We'll start off by creating our skeleton structure for a controller:

defmodule VocialWeb.PollControllerTest do use VocialWeb.ConnCaseend

Okay, the skeleton is there, but ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.