Chapter 8Testing Controllers and Views

Rails applications follow a model-view-controller, or MVC, pattern. The view layer has the responsibility of presenting data to the user, which in a server-side web application usually means generating HTML. Ideally, the view layer does this with minimal interaction with the model. The controller takes in information about the user request, contacts the appropriate parts of the model layer for data, and passes that information on to the view layer. The following is a very simplified diagram.

images/mvc.png

Testing Rails controllers and views is more challenging than testing Rails models. You can see from the diagram that ...

Get Rails 4 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.