зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] fix Gem::Dependency#to_spec returning nil when prerelease is the only available version
https://github.com/rubygems/rubygems/commit/a7dcc7214b
This commit is contained in:
Родитель
2dba441397
Коммит
5ddf4f5c95
|
@ -330,7 +330,7 @@ class Gem::Dependency
|
|||
unless prerelease?
|
||||
# Move prereleases to the end of the list for >= 0 requirements
|
||||
pre, matches = matches.partition {|spec| spec.version.prerelease? }
|
||||
matches += pre if requirement == Gem::Requirement.default
|
||||
matches += pre if requirement == Gem::Requirement.default || matches.empty?
|
||||
end
|
||||
|
||||
matches.first
|
||||
|
|
|
@ -394,6 +394,16 @@ class TestGemDependency < Gem::TestCase
|
|||
assert_match "Could not find 'b' (= 2.0) among 1 total gem(s)", e.message
|
||||
end
|
||||
|
||||
def test_to_spec_with_only_prereleases
|
||||
a_2_a_1 = util_spec "a", "2.a1"
|
||||
a_2_a_2 = util_spec "a", "2.a2"
|
||||
install_specs a_2_a_1, a_2_a_2
|
||||
|
||||
a_dep = dep "a", ">= 1"
|
||||
|
||||
assert_equal a_2_a_2, a_dep.to_spec
|
||||
end
|
||||
|
||||
def test_identity
|
||||
assert_equal dep("a", "= 1").identity, :released
|
||||
assert_equal dep("a", "= 1.a").identity, :complete
|
||||
|
|
|
@ -3801,6 +3801,13 @@ end
|
|||
assert Gem::Specification.find_by_name "q"
|
||||
end
|
||||
|
||||
def test_find_by_name_with_only_prereleases_with_requirements
|
||||
q = util_spec "q", "2.a"
|
||||
install_specs q
|
||||
|
||||
assert Gem::Specification.find_by_name "q", ">= 1"
|
||||
end
|
||||
|
||||
def test_find_by_name_prerelease
|
||||
b = util_spec "b", "2.a"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче