Fixing generated Phoenix tests (Trello clone P1)

In this episode we'll continue exploring testing (which we started last episode) and start building a Trello clone with Phoenix 1.4.

In particular, we're going to look at what tests get generated by mix phx.gen.html, and how they break down in the case of Ecto relations. This is by design—there are a lot of choices to be made about associations and there's a good case to be made for the generators to leave these choices to the developer.

When generating multiple schemas (or controllers or full the HTML context + schema + controller + templates bundle), one good option is to skip generating tests at all and write your own to fit your app. Instead of doing that, though, we'll be generating multiple related schemas and then going back and fixing the tests.

(Source code available for premium members)

Next episode: Part 2: Finishing the scaffold

Back to index

No Comments