-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
introduce #has_all parameter matcher #673
Comments
Thanks for your interest in Mocha. I am open to the idea of adding a matcher like this, but I'm not convinced about the name As an aside, if we add a matcher like this, I'd like to add a similar one for hashes as per the note for this commit:
|
@floehopper perfect, I agree with |
@floehopper PR added |
Recently I was trying to mock a method that receives an array of ids as an argument, I don't care about the order of the ids so I am not sorting when fetching the records.
So the test was sometimes failing randomly as the order of the array is not consistent, example:
Using
my_service.stubs(:my_method).with(includes(1, 2))
solved my issue...however the test will still pass if the array has an extra item which is not desirable in this caseSo I wanted to suggest introducing a
has_all
matcher that checks if two arrays contain the same elements regardless of their order.If you think this would be useful, I would gladly open a PR for it
Thank you
The text was updated successfully, but these errors were encountered: