Open mwlang opened 5 years ago
IMO this should be a separate shard, building on top of webmock.
I discovered while reading through other issues on this shard that "hi8" exists and probably should close this issue on account. See #20 for more info. Still open to discussion about adding this kind of functionality. For me, it's hard to say whether it's worth a separate shard or not. If all Crystal shards were easier to find out in the wild, then I'd definitely agree.
I'd be happy to submit a PR that implements VCR-like support as implemented here:
https://github.com/mwlang/binance/blob/master/spec/support/vcr.cr
Basic idea taken from the Ruby VCR gem
With this, it makes writing a spec like this possible:
The first time a cassette is called and it's file does not exist, then the spec is implemented with a live call to the API server, capturing the response and writing both the request and response data to a *.yml file. The subsequent calls plays back the information captured.
Is there interest in adding this to the webmock shard? If so and approved, I'll implement in a PR and submit for consideration. If not interested, I will perhaps consider extracting this to a public shard, but would not have the time to take on a full-fledged re-implementation of the original Ruby vcr gem, hence the thought to contribute into the webmock framework where it's likely to be better maintained and grow with the community support.