I recently needed to test the integration between two Rails apps running locally on my machine and wanted to record the HTTP interactions with VCR. VCR enables you to mock HTTP requests by recording interactions and later replay them when you run your tests. This is useful when dealing with third-party API’s and if your application is interacting with other applications you don’t want to depend on when running your tests.
VCR has an option which disables it from mocking any requests to localhost. As I
turned this option off, another problem arose; it wouldn’t allow selenium-webdriver to
http://127.0.0.1/_IDENTITY_ (why it needs this I do not know). In
searching for an answer I came upon this neat, and seemingly undocumented, feature of
VCR: Ignoring requests to specific hostnames.
Another use-case could be to ignore all requests to Facebook:
The feature was enabled in this commit, as a response to this issue. So to enable this feature you need version 2 or greater of VCR.