Let's take a moment to improve the structure of our tests. Have you noticed that, time and time again, we follow a similar pattern when arranging the world for a test? Instead, let's refactor this code into a fluent factory class to save time. To do this, we'll use a technique that I first learned from John Bonaccorsi in his Tidy up Your Tests with Class-Based Model Factories article. I encourage you to give it a read if you'd like to learn more.
View the source code for this episode on GitHub.