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 the specs scope as the cassette name when the description is empty #514
Use the specs scope as the cassette name when the description is empty #514
Conversation
The scope remains relatively stable when new spec are inserted into the suite. It's not as good as a description, but better than nothing.
I could use the Proc's source (instead of the scope) by using the |
metadata[:scoped_id] | ||
else | ||
metadata[:description] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure the state of things is that metadata[:description]
will either be a full string "something"
or an empty string ""
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the case while I had my debugger in that line. I can play save and add a nil-check, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's best, unless we can be better up the line and add a place that does metadata[:description] = ... || ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this method in the rspec core, the description can never be nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krainboltgreene is that info what you needed? Or shall I add a nil check?
Sorry this took so long to respond, I wasn't getting notifications and now that's fixed. Great catch, I'll merge once I'm sure about that question. |
@krainboltgreene thanks for answering :) Do you like the scope or the method_gem approach more? I can do either way. |
@tessi Scope is good enough. I'll keep a note for trying method_gem if people have problems. |
Use the specs scope as the cassette name when the description is empty
@tessi Thanks! |
The scope remains relatively stable when new spec are inserted into the suite.
It's not as good as a description, but better than nothing.
Relates to (and possibly fixes) #378.
This patch helps a lot with
it { is_expected.to be 'something' }
-style specs.Multiple of those specs overwrite each others cassettes, which is fixed by this patch.
#378 has a rather long discussion about which cassette name should be used in this case. I'd vote for the scope because
method_source
gem, but it has other limitations for example with dynamically defined specs)The nested scope does not change when changing existing specs, or appending specs to the suite.