-
Notifications
You must be signed in to change notification settings - Fork 18
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
Mocha-related test failures #121
Comments
This appears to be related to freerange/mocha#436 |
Worked around in ec9b4ce Not sure how long term of a fix that's going to be; there's still a DeprecationWarning. |
Well, I guess not really - I just got another error when I tried the workaround - see the commit comment in ea899c6 |
@apiology Sorry to hear this. I've opened a new issue and am investigating. |
This was highlighted when investigating this issue [1]. It turned out that this project was calling Expectation#multiple_yields with non-Array arguments, mostly/all Strings. See #443 for details. While the documentation said that each argument should be an Array, it turned out that in most cases the functionality still worked with non-Array arguments, but I suspect this was by accident rather than design. One exception to this was if an argument was a Hash, then it ended up being passed to the block as an Array of two-element Arrays. This code [2] which is used to optionally displays invocations was assuming that `yield_args` was always an Array, but this was not true. Similarly this code [3] which is used to display a deprecation warning was also assuming that `yield_args` was always an Array. And it was the latter which was causing the NoMethodError [4] in the apiology/quality project. I've hopefully fixed the underlying problem by wrapping any non-Array argument in an Array. Note that using Kernel#Array was not an option, because this didn't give the correct behaviour for Hash arguments. There is an argument to say that this was undocumented behaviour, but I think that seems unnecessarily strict in this case. [1]: apiology/quality#121 [2]: https://github.com/freerange/mocha/blob/1070fc02015a8ea36ad50782f80b557813595c02/lib/mocha/invocation.rb#L24 [3]: https://github.com/freerange/mocha/blob/1070fc02015a8ea36ad50782f80b557813595c02/lib/mocha/invocation.rb#L29 [4]: https://circleci.com/gh/apiology/quality/351
It turns out that you were relying on some undocumented behaviour of FWIW I believe you could fix the problem by changing this line from: quality_checker.expects(:execute).multiple_yields(*lines) to: quality_checker.expects(:execute).multiple_yields(*lines.map { |line| [line] }) However, since the undocumented behaviour of I have verified that this PR ☝️ does indeed fix the build on your branch. Hopefully when this other pull request gets merged you'll have a solution which avoids the deprecation warnings too. Let me know if you have any questions. |
There's now a new release of mocha (v1.11.0) which contains both freerange/mocha#441 & freerange/mocha#444. |
I've opened #125 to demonstrate how you might solve this problem. Let me know if you have any questions. |
With Mocha 1.10.0 and 1.10.1 (upgraded from 1.9.0), I get the following errors on the existing tests:
The text was updated successfully, but these errors were encountered: