What You’ve Done

In this chapter you walked through many of the different layers and tools in Rails, and saw how RSpec provides the ability to test those layers in isolation. You learned about views, controllers, mailers, routing, and background jobs. Focused view tests are possible in Rails but overlap heavily with helper tests, logic placed in presenter objects, and integration testing. Mailers and background jobs can also be tested in isolation. Although each of these layers has testing tools built for them, you may choose to test them via isolation tests or by placing most of the logic in non-Rails Ruby objects and testing those as their own unit.

Testing specific parts of the Rails framework is often tricky. Unlike model testing (which ...

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.