This context will switch the .mockPaths() to tests/testthat/dir
(and then resets it to what it was before).
If the tests/testthat/dir folder doesn't exist, capture_requests() will
be run to create mocks.
If it exists, with_mock_api() will be run.
To re-record mock files, simply delete tests/testthat/dir and run the test.
with_mock_dir(dir, expr, simplify = TRUE, replace = TRUE)character string, unique folder name that will be used or created
under tests/testthat/
Code to run inside the fake context
logical: if TRUE (default), JSON responses with status 200
will be written as just the text of the response body. In all other cases,
and when simplify is FALSE, the "response" object will be written out to
a .R file using base::dput().
Logical: should the mock directory replace current mock
directories? Default is TRUE.