Applying Named Setup Functions to Our Tests

Let’s start applying named setup functions to our responses.

With the trade-offs in mind, we will choose to write some named setups to achieve the following:

  • Control duplication.

  • Simplify each test block.

Responses

Let’s start with /test/response_test.exs since it’s complex enough to need named setups, but simple enough to illustrate the concept.

The first step is to create the file with the basic heading, like this:

Get hands-on with 1400+ tech skills courses.