Who Controls the Controller?

All of the new tests pass, so let’s take stock. You still have one test pending—your end-to-end test still doesn’t like that the create action can’t be found in the ProjectsController. Now you have all the pieces you need to write that action.

The next question is, are you going to write any tests specifically to target the logic in the controller? And the answer, perhaps surprisingly, is “no.” Or at least “not with the tools already discussed.”

Controller tests, which have been a feature of Rails from the beginning, have increasingly been seen as lower-value tests in a couple of different ways.

If you write Rails applications the way that the Rails core team writes Basecamp (their flagship application) and follow ...

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.