-
-
Notifications
You must be signed in to change notification settings - Fork 507
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Add :single_cassette option to RSpec metadata #700
Comments
I just came across into this and I'm curious if I want a similar feature than you. Would |
I'm with the same problem right now and found this by searching for a nice solution. In my case all |
This especially handy when you have bunch of |
I would like to note though, that proposed API seems a bit confusing although all my attempts to propose something better failed. |
I agree about the API. I'm wondering if describe '#delete' do
subject { foo.delete }
context 'success', vcr: { cassette_group: true } do
# ...
end
context 'failure', vcr: { group_cassettes: true } do
# ...
end
end |
I absolutely love this feature and have been wanting it since I started using VCR at least 5 years ago. I'd like to help push this over the finish line if that's is desired still (if not just let me know). I believe what is preventing the merge is:
Is that true? Regarding the API name, my opinion is that |
@hirowatari A maintainer could weigh in better of course, but your assessment sounds right to me just from looking at this issue and the related PR. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Background
I've been testing an API call with VCR that I can't really re-do (it works a bit like a delete) because I have to create it manually and use the resulting
id
in my spec. It's something like this:In this situation, each of the
it
blocks records its own cassette. But I need a newid
for each new request, so when I'm re-recording my cassettes, the firstit
passes and the subsequent ones fail.I could just copy/paste the first cassette with matching names for the other blocks, but it doesn't feel right.
Then I found I could use the
:cassette_name
option which ensures all myit
s use the same cassette.So I changed my specs:
But now I'm manually writing the cassette names to keep the same naming scheme as the automatically generated cassettes.
Proposed solution
It would be really cool if we could specify we want a single cassette to be generated based on the block path, like this:
Sorry for the long wall of text and code, I couldn't find a succinct way to explain this.
I'd love have a go at this if you guys think it's a good idea (although I'll be leaving on vacation soon and will probably not have access to a computer for at least a month, but I'll do it then).
I realize there might be something I'm not doing right here so I'm open to suggestions that don't include adding a new feature :)
The text was updated successfully, but these errors were encountered: