This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Ensure two RemoteSpecifications are comparable #3815
Merged
indirect
merged 3 commits into
rubygems:master
from
timblair:compare-stub-specifications
Jul 10, 2015
Merged
Ensure two RemoteSpecifications are comparable #3815
indirect
merged 3 commits into
rubygems:master
from
timblair:compare-stub-specifications
Jul 10, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The RemoteSpecification#sort_obj method was added in e5d936e (which was cherry-picked from #3767) to fix #3762, but it still fails when comparing two instances of RemoteSpecification. As #sort_obj is private, the check for other.respond_to?(:sort_obj) returns false, which means the <=> check falls back to the default (from Object) which returns nil if the objects being compared don't match. This then results in an ArgumentError when (e.g.) sorting an array containing multiple instances of RemoteSpecification. The fix is simple: make RemoteSpecification#sort_obj public.
/cc @tony-spataro-rs as author of the original fix. |
The original cases ("not zero") would still pass if the check resulted in a nil response.
Good catch; thanks! Fix LGTM. |
thanks. :) |
indirect
added a commit
that referenced
this pull request
Jul 10, 2015
Ensure two RemoteSpecifications are comparable
Cherry-picked to 1-10-stable ending with 856ef24. |
ghost
mentioned this pull request
Jul 21, 2015
There is a estimated release date? It is holding me to upgrade bundler on a rails 2.3 application. |
Sorry, I don't know; I'm not closely related to the Bundler project. While you're waiting, you could monkey-patch Tim Blair's fix into your app (just redefine the method in an initializer). |
I plan to release 1.10.6 when I get home tonight |
@segiddins nice, keep me updated <3 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
RemoteSpecification#sort_obj
method was added in e5d936e (which was cherry-picked from #3767) to fix #3762, but it still fails when comparing two instances ofRemoteSpecification
.As
#sort_obj
is private, the check forother.respond_to?(:sort_obj)
returnsfalse
, which means the<=>
check falls back to the default (fromObject
) which returnsnil
if the objects being compared don't match. This then results in anArgumentError
when (e.g.) sorting an array containing multiple instances ofRemoteSpecification
.The fix is simple: make
RemoteSpecification#sort_obj
public.