Summary
Explore testing strategies for Rails components such as views, controllers, mailers, routing, and background jobs. Understand how to isolate tests for faster and more reliable results, and the balance between stubbing and integration. Learn the benefits of moving controller logic to action objects to simplify tests and improve application structure.
We'll cover the following...
What we’ve done
In this chapter, we walked through many of the different layers and tools in Rails and saw how RSpec provides the ability to test those layers in isolation.
We learned about views, controllers, mailers, routing, and background jobs. Focused view tests are possible in Rails but overlap heavily with helper tests, logically placed in presenter objects and integration testing. Mailers and background jobs can also be tested in isolation. Although each of ...