This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 394
Consider renaming (or aliasing) match_array
to contain_exactly
#398
Comments
I like |
This works pretty OK: expect(something.result).to contain_exactly(*things) But I'm on the fence about the deprecation, too. |
My concern is that requiring people use |
Newer rubyists aren't as comfortable with the splat operator. I like |
Specifying the splat difference of course ;) |
Indeed |
myronmarston
added a commit
that referenced
this issue
Dec 24, 2013
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In #119 when we added the new
expect
syntax and chose to not support the operator matchers for that syntax, we had to come up with a name forarray.should =~ other_array
, and decided onmatch_array
as the name after a rather lengthy discussion. (See #119 (comment) and following for the full conversation).Working on #393 and seeing how well the matcher name matches the
description
output for almost all matchers, I realized thatmatch_array
's description hints at a better name. The description iscontain exactly <pretty printed array>
. During a skype call with @xaviershay about #393 he mentioned some confusion about what the exact semantics ofmatch_array
are (sincematch
is such a generic term) and I'm thinking thatcontain_exactly
is a better name, e.g.:Compare to:
The fact that with
match_array
you have to wrap the elements in[ ]
has always bugged me a bit (as it makes it more syntactically noisy), but I've always felt like that sincematch_array
has the word "array" in it, the argument should be an array. Withcontain_exactly
it doesn't give that connotation and I think it reads better w/o the array square brackets.If we do move in this direction, there's a few open questions:
match_array
and keep onlycontain_exactly
? I'm on the fence about this. On the one had, there's no significant maintenance cost to keeping both. On the other hand, it'll probably never be less painful than it is now to deprecatematch_array
: we have 2.99 for the migration andtranspec
will likely support the conversion out of the box. However, I've gotten some feedback on twitter that some users feel like we are renaming/deprecating things too quickly (although, that was more about 2.14 than 2.99, and I think 2.99's deprecation support is significantly more user-friendly)match_array
, will it be confusing thatmatch_array
accepts a single array arg where ascontain_exactly
accepts them splatted out?/cc @xaviershay @JonRowe @samphippen @soulcutter @alindeman
The text was updated successfully, but these errors were encountered: