O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Who Controls the Controller?

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

Since we’ve put our business logic in the action object, the controller doesn’t have much logic, but it does have some. Specifically, the controller sends data to both the action object and onward to the view layer. Although we haven’t stressed the point, the controller also needs to do something in case the action object errors or does something else unexpected. Notice that we’ve separated responsibilities here—almost nothing that the controller does is dependent on the logic of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required