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
Change matcher protocol and definition API to not reference should
and should_not
#270
Comments
So I'm thinking s/should/expectation/ on most of these and s/should not/negative expectation. That is:
Thoughts? |
The terminology on matchers can use the domain of matching and mismatching:
|
I'm not sure these are better, but:
|
I like the shorter ones that @booch suggests, although haven't we been discussing using |
I like @samphippen's suggestions, personally.
Interesting idea, but IMO, "mismatch" gives the wrong sense: to me, a mismatch, suggests a failure of an attempted positive expectation. It doesn't suggest a negative expectation to me.
On the built-in matchers, we've discussed aliasing |
Ah ok, brain misfire :) |
+1 on @booch's suggestion. |
I've gone back and forth on which I like better. I think my sticking point with @booch's suggestion is the |
How about |
I like those, but what about flipping them? In fact... what about:
|
I like positive_match
negative_match
positive_failure_message
negative_failure_message ...which doesn't line up with |
+1 these:
Clarity beats symmetry, and these ones have the benefit of mostly being terse. |
I don't like any of the options presented here, but I don't have a better suggestion. The words positive or negative or negated apply to the expectation, not the message. I think these names tell the right story:
... but obviously they are painfully long. FYI - the original names were I can almost get behind @myronmarston's suggestion ( Wish I had a better answer. Good luck! |
Of the proposals thus far, I prefer @myronmarston 's
The similarly-prefixed methods go together, which makes it clearer to me. Negated is descriptive, but will not be as self-evident. |
I still prefer:
As this way the method names are paired with their opposite, I find the prefixes not matching for the same functionality confusing. |
Funny how it's hard to get consensus on this! A few points of clarification (although these things may already be obvious):
At this point, I think I like @JonRowe's suggestion the best: match
match_when_negated
failure_message
failure_message_when_negated In particular, Barring a better suggestion between now and however long it takes me to put up a PR for this, that's what I'll go with. Any objections? |
go man go |
No objections here. |
I like those too. |
|
Fixed by #373. |
We've been moving in the direction of
expect
fromshould
but there are "legacy" bits of the API that still speak in terms ofshould
andshould_not
. In 3.0 I'd like to come up with an improved API that doesn't use these terms while still maintaining compatibility for code out there that is based on those APIs, and then we can remove the old APIs in 4.0.The specific APIs:
failure_message_for_should
andfailure_message_for_should_not
as part of the matcher protocol and custom matcher DSL.match_for_should
andmatch_for_should_not
as part of the custom matcher DSL.RSpec::Matchers.last_should
.I don't have a proposal for new names for these yet...this is mostly a place holder issue to facilitate discussion :).
The text was updated successfully, but these errors were encountered: