From 4a88c77eea27505cb754c26bd5288f48f72733ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Pitucha?= Date: Wed, 2 Oct 2019 11:18:24 +1000 Subject: [PATCH] Describe clearing cached stubs This was the solution proposed in https://github.com/lostisland/faraday/issues/1041 --- docs/adapters/testing.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/adapters/testing.md b/docs/adapters/testing.md index 41f661cf3..fb19f68e8 100644 --- a/docs/adapters/testing.md +++ b/docs/adapters/testing.md @@ -72,6 +72,14 @@ verify the order or count of any stub. stubs.verify_stubbed_calls ``` +After the test case is completed (possibly in an `after` hook), you should clear +the default connection to prevent it from being cached between different tests. +This allows for each test to have its own set of stubs + +```ruby +Faraday.default_connection = nil +``` + ## Examples Working [RSpec] and [test/unit] examples for a fictional JSON API client are