-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Ensure null objects behave correctly with to_a and to_ary #358
Conversation
Changes Unknown when pulling f7caa59 on revisited_bugfix_for_doubles_in_arrays into * on master*. |
Need any help with 1.8.7 here @JonRowe? I have some bandwidth if needed. |
Thanks @alindeman I sussed it, 1.8.7 has a default implementation of |
return 0 if message == :to_int && __mock_proxy.null_object? | ||
if __mock_proxy.null_object? | ||
return 0 if message == :to_int | ||
return nil if [:to_a,:to_ary].include? message |
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.
Would this look any better as a case
statement?
case message
when :to_int
0
when :to_a, :to_ary
nil
end
I'm not sure. What do you think?
Changes Unknown when pulling 3efca73 on revisited_bugfix_for_doubles_in_arrays into * on master*. |
Changes Unknown when pulling faa04cf on revisited_bugfix_for_doubles_in_arrays into * on master*. |
Changes Unknown when pulling 71f39f7 on revisited_bugfix_for_doubles_in_arrays into * on master*. |
Looks good to me. |
…rays Ensure null objects behave correctly with to_a and to_ary
Further to #357 we could return
nil
when thedouble
is aas_null_object
, we shouldn't change the behaviour when it's not a null object but this could be considered slightly more correct behaviour.