class Gem::TestCase::SpecFetcherSetup

def setup_fetcher # :nodoc:

:nodoc:
def setup_fetcher # :nodoc:
  require 'zlib'
  require 'socket'
  require 'rubygems/remote_fetcher'
  unless @test.fetcher
    @test.fetcher = Gem::FakeFetcher.new
    Gem::RemoteFetcher.fetcher = @test.fetcher
  end
  Gem::Specification.reset
  begin
    gem_repo, @test.gem_repo = @test.gem_repo, @repository
    @test.uri = URI @repository
    @test.util_setup_spec_fetcher(*@downloaded)
  ensure
    @test.gem_repo = gem_repo
    @test.uri = URI gem_repo
  end
  @gems.each do |spec, gem|
    next unless gem
    @test.fetcher.data["#{@repository}gems/#{spec.file_name}"] =
      Gem.read_binary(gem)
    FileUtils.cp gem, spec.cache_file
  end
end