Summary

In this chapter, we learned about RSpec's mocks, which let us change how specific parts of our code behave during tests. We also learned about hooks, which we used to set up and tear down state for our test cases. Using these tools, we learned how to test complex stateful behavior in our application code, which we also adjusted to increase testability.

Get RSpec Essentials 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.