-
Notifications
You must be signed in to change notification settings - Fork 12
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
Context-dependent fixture recording? #269
Comments
What are the definitions of
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So in getwilds/rcromwell#44 a use case has come up that it'd be nice to have context-dependent usage of cassettes.
Consider the following use case where jobs are submitted to some engine that makes widgets. However, it takes some time before the metadata on jobs is available after submission. This is not a great situation for tests.
Right now when I want to re-record the cassette (or on the very first recording I did) I have to make sure the
Sys.sleep
is not commented out because thesubmit_job
call kicks off some process that leads to some wait time before appropriate data will return fromjob_metadata
. (of course you may want to test these different behaviors, but lets's assume we want to test the behavior ofjob_metadata
when the metadata is present.Consider the possibility of
Where
on_new_cassette
andif_vcr_off
both accept a list of two things: before and after (or other names?), where each accepts a function, formula list or NULL, just likehttr2:::as_mock_function
on_new_cassette
is ignored if it's not a new cassette - what should happen if re-recording? if it's a new cassette then the before callback is run for before recording, and the after callback after recordingI think this takes care of the 3 scenarios in the linked issue - making it so that tests could be run without any manual toggling on/off of sleeps
The text was updated successfully, but these errors were encountered: