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
use multiple cassettes or merge cassettes #306
Comments
You can nest cassettes: VCR.use_cassette("outer") do
make_some_http_request
VCR.use_cassette("inner_1") do
make_some_other_http_request
VCR.use_cassette("inner_2") do
make_yet_another_request
end
end
end When a request is made VCR will search the cassette stack starting at the innermost cassette to find a matching HTTP interaction to replay. It'll record new requests to the innermost cassette. Does that meet your needs? |
yes, that definitely fits my needs. I would still prefere using rspec metadata for this, like Anyhow, the issue is resolved for me. Thanks! |
I can see the appeal of that API, but when a new HTTP request is made, how would it know which cassette to record it to? |
could be the last by convention. Just like nesting use_cassette uses the most inner one by convention. I'd understand it as |
But then how would the first cassette ever get anything recorded to it? Explicit nesting is supported because you can make requests at points where only the outer one is inserted (and thus have it get recorded to that cassette): VCR.use_cassette("outer") do
# <- requests here get recorded to outer
VCR.use_cassette("inner") do
# <- requests here get recorded to inner
end
# <- requests here get recorded to outer as well
end If VCR automatically inserted two cassettes, w/o giving you a chance to make any requests while just the first one is inserted...then nothing would ever get recorded to it and it would never be used. |
fair enough. I guess that comes down to user behavior. Since I usually use |
Hi,
is there a way to use multiple cassettes at the same time? If not, that would be a feature request.
Thanks,
Robin
The text was updated successfully, but these errors were encountered: