Add VcrStorage abstraction
Closed this issue · 0 comments
Right now when creating a VCR client/backend, you have to pass in a file path like:
VcrBackend(
...
recordingPath = Paths.get("vcr/example.json")
)
This isn't great because it assumes you always want to write to a file, but that's too strong of an assumption. We should be able to pass in something like a VcrStorage
trait which would have the save()
method inside it. So you could pass in FileVcrStorage
, InMemoryStorage
, and whatever custom implementation a user may want. For example, a user could create an S3VcrStorage
if they wanted to (maybe useful for CI environments?).
Also, after this is done, we no longer need to use temporary files in our tests. We could use InMemoryStorage
for those.
This is somewhat related to #3. It's at least a prerequisite for it. The choice of format (JSON, YAML, etc.) would also probably go in here (but that would be a separate PR).