-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Check need_auto_run=
method is defined also
#1350
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
Conversation
@@ -37,7 +37,7 @@ module Rails | |||
# date). If so, we turn the auto runner off. | |||
require 'test/unit' | |||
require 'test/unit/assertions' | |||
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner) | |||
Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner.need_auto_run = ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh... TIL... I would have expected this to blow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined?
is quite magical!
So why wouldn't this exist if |
This version from the Ruby codebase doesn't have that method. It has no alternative that I can see. Compare to the test-unit gem version. |
So do we just need this check on line 65? As the first one should be guaranteed to use the gem? |
@cupakromer Actually, that's the line I experienced the error. [Edit] Would you like me to remove the |
@orien Good question. I think it was being defensive for changes in the future. In which case, your check is actually better. It seems the method was introduced sometime between the test-unit 2.4.0 and 2.4.9 gems. 👍 |
@JonRowe I didn't see a clean replacement for the Ruby version. The gem version seems like it has an alternative in: |
@orien if you want to add the 2nd fallback for |
@cupakromer I used a non bang version of that method name. As per http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist |
This looks good to me :) |
Thanks for this @orien 💙 |
Check `need_auto_run=` method is defined also
To prevent errors such as: