Chapter 5. Simulating External Services

In Chapter 4, Setting Up and Cleaning Up, we learned how to manage external resources such as databases and web services. In this chapter, we'll learn more advanced techniques for managing external web services using the VCR gem, which allows us to record real HTTP requests and then replay them in our tests.

The importance of external web services

It is increasingly common for software to rely on external web services. These can be from a third party, such as the openweathermap.org API we saw in Chapter 4, Setting Up and Cleaning Up. However, we are likely to also interact with web services from within our own organization, or those that we have written ourselves. Not only do web services allow us to access ...

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.