1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems/test_gem_dependency_resolver_index_set.rb
drbrain f06f903231 * lib/rubygems: Update to RubyGems 2.1.0. Fixes CVE-2013-4287.
See http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
  for CVE information.

  See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09
  for release notes.

* test/rubygems:  Tests for the above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-10 00:52:14 +00:00

53 lines
1.2 KiB
Ruby

require 'rubygems/test_case'
require 'rubygems/dependency_resolver'
class TestGemDependencyResolverIndexSet < Gem::TestCase
def test_load_spec
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
a_2 = quick_spec 'a', 2
a_2_p = quick_spec 'a', 2 do |s| s.platform = Gem::Platform.local end
Gem::Specification.add_specs a_2, a_2_p
util_setup_spec_fetcher a_2, a_2_p
source = Gem::Source.new @gem_repo
version = v 2
set = Gem::DependencyResolver::IndexSet.new
spec = set.load_spec 'a', version, Gem::Platform.local, source
assert_equal a_2_p.full_name, spec.full_name
end
def test_load_spec_cached
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
a_2 = quick_spec 'a', 2
a_2_p = quick_spec 'a', 2 do |s| s.platform = Gem::Platform.local end
Gem::Specification.add_specs a_2, a_2_p
util_setup_spec_fetcher a_2, a_2_p
source = Gem::Source.new @gem_repo
version = v 2
set = Gem::DependencyResolver::IndexSet.new
first = set.load_spec 'a', version, Gem::Platform.local, source
util_setup_spec_fetcher # clear
second = set.load_spec 'a', version, Gem::Platform.local, source
assert_same first, second
end
end