diff options
author | Kevin Logan <klogan@enova.com> | 2019-05-14 00:02:48 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-10 20:54:29 +0900 |
commit | eb2d3c19fe70812f1f826eef225613baba3cc087 (patch) | |
tree | 48077433112ae88b33069b27ae79509489ff3426 /test/rubygems/test_gem.rb | |
parent | 0e60bc118b66d626d7e1f985dbd15cfba5e62715 (diff) | |
download | ruby-eb2d3c19fe70812f1f826eef225613baba3cc087.tar.gz |
[rubygems/rubygems] Properly fetch Gem#latest_spec_for with multiple sources
https://github.com/rubygems/rubygems/commit/a93ec63df3
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r-- | test/rubygems/test_gem.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 3c95982d4b..f0f36b5561 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -888,6 +888,27 @@ class TestGem < Gem::TestCase assert_equal gems['a-2'], spec end + def test_self_latest_spec_for_multiple_sources + uri = 'https://example.sample.com/' + source = Gem::Source.new(uri) + source_list = Gem::SourceList.new + source_list << Gem::Source.new(@uri) + source_list << source + Gem.sources.replace source_list + + spec_fetcher(uri) do |fetcher| + fetcher.spec 'a', 1.1 + end + + gems = spec_fetcher do |fetcher| + fetcher.spec 'a', 1 + fetcher.spec 'a', '3.a' + fetcher.spec 'a', 2 + end + spec = Gem.latest_spec_for 'a' + assert_equal gems['a-2'], spec + end + def test_self_latest_rubygems_version spec_fetcher do |fetcher| fetcher.spec 'rubygems-update', '1.8.23' @@ -912,6 +933,29 @@ class TestGem < Gem::TestCase assert_equal Gem::Version.new(2), version end + def test_self_latest_version_for_multiple_sources + uri = 'https://example.sample.com/' + source = Gem::Source.new(uri) + source_list = Gem::SourceList.new + source_list << Gem::Source.new(@uri) + source_list << source + Gem.sources.replace source_list + + spec_fetcher(uri) do |fetcher| + fetcher.spec 'a', 1.1 + end + + spec_fetcher do |fetcher| + fetcher.spec 'a', 1 + fetcher.spec 'a', 2 + fetcher.spec 'a', '3.a' + end + + version = Gem.latest_version_for 'a' + + assert_equal Gem::Version.new(2), version + end + def test_self_loaded_specs foo = util_spec 'foo' install_gem foo |