-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
undetermined behaviour using parenthesis or curly-braces in expect
#525
Comments
Some discussion here: https://gist.github.com/weirdcanada/1313a95e3d891eebca32 |
(I am also open to this potentially not being an issue in |
Parenthesis vs curly braces are a red herring here. The issue is In general, you should be passing an argument to
Let me know if that doesn't make sense. |
@myronmarston thanks for your detailed response and for re-writing the issue. I'm not sure if I quite follow you, though. By your explanation, the following should not throw the
Am I understanding your delineation between explicitly passing a value and not? |
@myronmarston ah, nm, I see what you're saying now. This seems to be a bug as the proc may simply return |
@weirdcanada that's not exactly correct. The Only certain matchers expect blocks. |
@cupakromer ah, I see. Thank you. Today we all learn a valuable lesson in referential transparency :) |
BTW, this inspired me to open #526 to help better guide users of when to pass an argument vs a block. |
@weirdcanada -- if you try your example against master, you'll find it provides much clearer errors. |
@myronmarston awesome. thank you. I'll try this at work wednesday! |
It is unclear where this issue resides, but I'm pretty certain it's in
expect
and happens when you alternate between using curly or parenthesis. In this case, I've created a class that callssuper
in various ways and in two cases usingexpect( ... )
produces anArgumentError
.The main issue is that the error returned (
ArgumentError
) is unclear and obscures the real issue.I am submitting this as an issue because the behaviour is unclear. It seems that using curly braces is the preferred solution always, but nonetheless, if they're not being used a suitable error should be thrown.
Here is how you can reproduce it simply:
The result is:
The text was updated successfully, but these errors were encountered: