Making the Test Pass

Now it’s time to make the first test pass.

But how?

It seems like a straightforward question, but it has a few different answers.

  • The purist way: Do the simplest thing that could possibly work. In this case “work” means “minimally pass the test without regard to the larger context.” Or it might even mean “write the minimum amount of code to clear the current error without regard to the larger context.”

  • The “practical” way (scare quotes intended): Write the code you know you need to eventually write, effectively skipping steps that seem too small to be valuable.

  • The teaching way: This method is somewhere between the other two and lets me best explain how and why test-driven development works without getting bogged down in ...

Get Rails 5 Test Prescriptions 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.