Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle scenarios where the inputs change on each test run #16

Open
jonleighton opened this issue Jan 11, 2021 · 0 comments
Open

Handle scenarios where the inputs change on each test run #16

jonleighton opened this issue Jan 11, 2021 · 0 comments

Comments

@jonleighton
Copy link

Thanks for Walkman! 🙇

I trialled it as a replacement for exvcr. Unfortunately I don't think it will work for my use case currently. I have database records which are being auto-generated on each test run, and so they have different IDs on each run (as well as other randomly-generated data that differs on each run).

My code is passing these IDs into an external API which I'm stubbing with Walkman. Once I've recorded my tape on the first run, on the second run I get an error along the lines of: {:walkman_error, "replay found {...} didn't match given mfa {...} because those IDs don't match.

exvcr, and Ruby's vcr which it is based upon, handle this by configurable "request matching". By default they only match on the URI, so differing params don't cause a problem. Obviously Walkman knows nothing about URIs so this is not a direct option.

I guess I'd like to be able to configure some sort of "call matcher" for Walkman, and perhaps there would be an option to only match by function name/arity. So long as my tape is replayed with the function calls in the same order, Walkman would return the recorded return values. This would probably be sufficient for my use case.

I could also imagine some sort of configurable matcher function for custom logic.

I'm also keen to hear your thoughts about this use case and whether there are workarounds I haven't thought of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant