[前][次][番号順一覧][スレッド一覧]

ruby-changes:31573

From: drbrain <ko1@a...>
Date: Tue, 12 Nov 2013 09:17:00 +0900 (JST)
Subject: [ruby-changes:31573] drbrain:r43651 (trunk): * lib/rubygems: Update to RubyGems master b9213d7. Changes include:

drbrain	2013-11-12 09:16:41 +0900 (Tue, 12 Nov 2013)

  New Revision: 43651

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43651

  Log:
    * lib/rubygems:  Update to RubyGems master b9213d7.  Changes include:
    
      Fixed tests on Windows (I hope) by forcing platform for
      platform-dependent tests.
    
      Fixed File.exists? warnings.
    
      Improved testing infrastructure.
    
    * test/rubygems:  ditto.
    
    * test/rdoc/test_rdoc_rubygems_hook.rb:  Switch to util_spec like
      RubyGems.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/rubygems_hook.rb
    trunk/lib/rubygems/source.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/rubygems/test_case.rb
    trunk/lib/rubygems/test_utilities.rb
    trunk/lib/rubygems.rb
    trunk/test/rdoc/test_rdoc_rubygems_hook.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_commands_build_command.rb
    trunk/test/rubygems/test_gem_commands_cleanup_command.rb
    trunk/test/rubygems/test_gem_commands_dependency_command.rb
    trunk/test/rubygems/test_gem_commands_fetch_command.rb
    trunk/test/rubygems/test_gem_commands_install_command.rb
    trunk/test/rubygems/test_gem_commands_list_command.rb
    trunk/test/rubygems/test_gem_commands_outdated_command.rb
    trunk/test/rubygems/test_gem_commands_pristine_command.rb
    trunk/test/rubygems/test_gem_commands_query_command.rb
    trunk/test/rubygems/test_gem_commands_sources_command.rb
    trunk/test/rubygems/test_gem_commands_specification_command.rb
    trunk/test/rubygems/test_gem_commands_stale_command.rb
    trunk/test/rubygems/test_gem_commands_uninstall_command.rb
    trunk/test/rubygems/test_gem_commands_unpack_command.rb
    trunk/test/rubygems/test_gem_commands_update_command.rb
    trunk/test/rubygems/test_gem_commands_which_command.rb
    trunk/test/rubygems/test_gem_dependency_list.rb
    trunk/test/rubygems/test_gem_dependency_resolution_error.rb
    trunk/test/rubygems/test_gem_dependency_resolver.rb
    trunk/test/rubygems/test_gem_dependency_resolver_dependency_conflict.rb
    trunk/test/rubygems/test_gem_dependency_resolver_index_specification.rb
    trunk/test/rubygems/test_gem_dependency_resolver_installed_specification.rb
    trunk/test/rubygems/test_gem_dependency_resolver_installer_set.rb
    trunk/test/rubygems/test_gem_doctor.rb
    trunk/test/rubygems/test_gem_ext_builder.rb
    trunk/test/rubygems/test_gem_indexer.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_local_remote_options.rb
    trunk/test/rubygems/test_gem_rdoc.rb
    trunk/test/rubygems/test_gem_request_set.rb
    trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb
    trunk/test/rubygems/test_gem_server.rb
    trunk/test/rubygems/test_gem_source.rb
    trunk/test/rubygems/test_gem_spec_fetcher.rb
    trunk/test/rubygems/test_gem_specification.rb
    trunk/test/rubygems/test_gem_uninstaller.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43650)
+++ ChangeLog	(revision 43651)
@@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 12 09:16:24 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems master b9213d7.  Changes include:
+
+	  Fixed tests on Windows (I hope) by forcing platform for
+	  platform-dependent tests.
+
+	  Fixed File.exists? warnings.
+
+	  Improved testing infrastructure.
+
+	* test/rubygems:  ditto.
+
+	* test/rdoc/test_rdoc_rubygems_hook.rb:  Switch to util_spec like
+	  RubyGems.
+
 Mon Nov 11 18:31:12 2013  Aman Gupta <ruby@t...>
 
 	* internal.h: move common string/hash flags to include file.
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb	(revision 43650)
+++ lib/rubygems/specification.rb	(revision 43651)
@@ -1393,7 +1393,7 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1393
   # Returns the build_args used to install the gem
 
   def build_args
-    if File.exists? build_info_file
+    if File.exist? build_info_file
       File.readlines(build_info_file).map { |x| x.strip }
     else
       []
Index: lib/rubygems/source.rb
===================================================================
--- lib/rubygems/source.rb	(revision 43650)
+++ lib/rubygems/source.rb	(revision 43651)
@@ -56,8 +56,6 @@ class Gem::Source https://github.com/ruby/ruby/blob/trunk/lib/rubygems/source.rb#L56
   # Returns a Set that can fetch specifications from this source.
 
   def dependency_resolver_set # :nodoc:
-    uri = api_uri
-
     bundler_api_uri = api_uri + './api/v1/dependencies'
 
     begin
Index: lib/rubygems/test_utilities.rb
===================================================================
--- lib/rubygems/test_utilities.rb	(revision 43650)
+++ lib/rubygems/test_utilities.rb	(revision 43651)
@@ -160,6 +160,164 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_utilities.rb#L160
 # :startdoc:
 
 ##
+# The SpecFetcherSetup allows easy setup of a remote source in RubyGems tests:
+#
+#   spec_fetcher do |f|
+#     f.gem  'a', 1
+#     f.spec 'a', 2
+#     f.gem  'b', 1' 'a' => '~> 1.0'
+#     f.clear
+#   end
+#
+# The above declaration creates two gems, a-1 and b-1, with a dependency from
+# b to a.  The declaration creates an additional spec a-2, but no gem for it
+# (so it cannot be installed).
+#
+# After the gems are created they are removed from Gem.dir.
+
+class Gem::TestCase::SpecFetcherSetup
+
+  ##
+  # Executes a SpecFetcher setup block.  Yields an instance then creates the
+  # gems and specifications defined in the instance.
+
+  def self.declare test
+    setup = new test
+
+    yield setup
+
+    setup.execute
+  end
+
+  def initialize test # :nodoc:
+    @test  = test
+
+    @gems       = {}
+    @installed  = []
+    @operations = []
+  end
+
+  ##
+  # Removes any created gems or specifications from Gem.dir (the default
+  # install location).
+
+  def clear
+    @operations << [:clear]
+  end
+
+  def created_specs
+    created = {}
+
+    @gems.keys.each do |spec|
+      created[spec.full_name] = spec
+    end
+
+    created
+  end
+
+  ##
+  # Creates any defined gems or specifications
+
+  def execute # :nodoc:
+    execute_operations
+
+    setup_fetcher
+
+    created_specs
+  end
+
+  def execute_operations # :nodoc:
+    @operations.each do |operation, *arguments|
+      case operation
+      when :clear then
+        @test.util_clear_gems
+        @installed.clear
+      when :gem then
+        spec, gem = @test.util_gem(*arguments, &arguments.pop)
+
+        write_spec spec
+
+        @gems[spec] = gem
+        @installed << spec
+      when :spec then
+        spec = @test.util_spec(*arguments, &arguments.pop)
+
+        write_spec spec
+
+        @gems[spec] = nil
+        @installed << spec
+      end
+    end
+  end
+
+  ##
+  # Creates a gem with +name+, +version+ and +deps+.  The created gem can be
+  # downloaded and installed.
+  #
+  # The specification will be yielded before gem creation for customization,
+  # but only the block or the dependencies may be set, not both.
+
+  def gem name, version, dependencies = nil, &block
+    @operations << [:gem, name, version, dependencies, block]
+  end
+
+  ##
+  # Creates a legacy platform spec with the name 'pl' and version 1
+
+  def legacy_platform
+    spec 'pl', 1 do |s|
+      s.platform = Gem::Platform.new 'i386-linux'
+      s.instance_variable_set :@original_platform, 'i386-linux'
+    end
+  end
+
+  def setup_fetcher # :nodoc;
+    require 'zlib'
+    require 'socket'
+    require 'rubygems/remote_fetcher'
+
+    @test.fetcher = Gem::FakeFetcher.new
+    Gem::RemoteFetcher.fetcher = @test.fetcher
+
+    Gem::Specification.reset
+
+    @test.util_setup_spec_fetcher(*@gems.keys)
+
+    # This works around util_setup_spec_fetcher adding all created gems to the
+    # installed set.
+    Gem::Specification.reset
+    Gem::Specification.add_specs(*@installed)
+
+    @gems.each do |spec, gem|
+      next unless gem
+
+      @test.fetcher.data["http://gems.example.com/gems/#{spec.file_name}"] =
+        Gem.read_binary(gem)
+
+      FileUtils.cp gem, spec.cache_file
+    end
+  end
+
+  ##
+  # Creates a spec with +name+, +version+ and +deps+.  The created gem can be
+  # downloaded and installed.
+  #
+  # The specification will be yielded before creation for customization,
+  # but only the block or the dependencies may be set, not both.
+
+  def spec name, version, dependencies = nil, &block
+    @operations << [:spec, name, version, dependencies, block]
+  end
+
+  def write_spec spec # :nodoc:
+    open spec.spec_file, 'w' do |io|
+      io.write spec.to_ruby_for_cache
+    end
+  end
+
+end
+
+##
 # A StringIO duck-typed class that uses Tempfile instead of String as the
 # backing store.
 #
Index: lib/rubygems/test_case.rb
===================================================================
--- lib/rubygems/test_case.rb	(revision 43650)
+++ lib/rubygems/test_case.rb	(revision 43651)
@@ -30,7 +30,6 @@ require 'fileutils' https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L30
 require 'tmpdir'
 require 'uri'
 require 'rubygems/package'
-require 'rubygems/test_utilities'
 require 'pp'
 require 'zlib'
 require 'pathname'
@@ -84,6 +83,8 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L83
 
 class Gem::TestCase < MiniTest::Unit::TestCase
 
+  attr_accessor :fetcher # :nodoc:
+
   def assert_activate expected, *specs
     specs.each do |spec|
       case spec
@@ -197,7 +198,8 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L198
     @orig_gem_path = ENV['GEM_PATH']
 
     @current_dir = Dir.pwd
-    @ui = Gem::MockGemUi.new
+    @fetcher     = nil
+    @ui          = Gem::MockGemUi.new
 
     tmpdir = File.expand_path Dir.tmpdir
     tmpdir.untaint
@@ -378,7 +380,7 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L380
 
     gem = File.join @tempdir, "gems", "#{spec.full_name}.gem"
 
-    unless File.exists? gem
+    unless File.exist? gem then
       use_ui Gem::MockGemUi.new do
         Dir.chdir @tempdir do
           Gem::Package.build spec
@@ -503,28 +505,11 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L505
     return spec
   end
 
-  def quick_spec name, version = '2'
-    # TODO: deprecate
-    require 'rubygems/specification'
-
-    spec = Gem::Specification.new do |s|
-      s.platform    = Gem::Platform::RUBY
-      s.name        = name
-      s.version     = version
-      s.author      = 'A User'
-      s.email       = 'example@e...'
-      s.homepage    = 'http://example.com'
-      s.summary     = "this is a summary"
-      s.description = "This is a test description"
-
-      yield(s) if block_given?
-    end
-
-    spec.loaded_from = spec.spec_file
-
-    Gem::Specification.add_spec spec
+  ##
+  # TODO:  remove in RubyGems 3.0
 
-    return spec
+  def quick_spec name, version = '2' # :nodoc:
+    util_spec name, version
   end
 
   ##
@@ -561,7 +546,9 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L546
 
   def util_clear_gems
     FileUtils.rm_rf File.join(@gemhome, "gems") # TODO: use Gem::Dirs
+    FileUtils.mkdir File.join(@gemhome, "gems")
     FileUtils.rm_rf File.join(@gemhome, "specifications")
+    FileUtils.mkdir File.join(@gemhome, "specifications")
     Gem::Specification.reset
   end
 
@@ -612,10 +599,11 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L599
   end
 
   ##
-  # Create a new spec (or gem if passed an array of files) and set it
-  # up properly. Use this instead of util_spec and util_gem.
+  # new_spec is deprecated as it is never used.
+  #
+  # TODO:  remove in RubyGems 3.0
 
-  def new_spec name, version, deps = nil, *files
+  def new_spec name, version, deps = nil, *files # :nodoc:
     require 'rubygems/specification'
 
     spec = Gem::Specification.new do |s|
@@ -656,7 +644,8 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L644
   end
 
   def new_default_spec(name, version, deps = nil, *files)
-    spec = new_spec(name, version, deps)
+    spec = util_spec name, version, deps
+
     spec.loaded_from = File.join(@default_spec_dir, spec.spec_name)
     spec.files = files
 
@@ -674,24 +663,38 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L663
   end
 
   ##
-  # Creates a spec with +name+, +version+ and +deps+.
+  # Creates a spec with +name+, +version+.  +deps+ can specify the dependency
+  # or a +block+ can be given for full customization of the specification.
 
-  def util_spec(name, version, deps = nil, &block)
-    # TODO: deprecate
-    raise "deps or block, not both" if deps and block
+  def util_spec name, version = 2, deps = nil # :yields: specification
+    raise "deps or block, not both" if deps and block_given?
+
+    spec = Gem::Specification.new do |s|
+      s.platform    = Gem::Platform::RUBY
+      s.name        = name
+      s.version     = version
+      s.author      = 'A User'
+      s.email       = 'example@e...'
+      s.homepage    = 'http://example.com'
+      s.summary     = "this is a summary"
+      s.description = "This is a test description"
+
+      yield s if block_given?
+    end
 
     if deps then
-      block = proc do |s|
-        # Since Hash#each is unordered in 1.8, sort
-        # the keys and iterate that way so the tests are
-        # deteriminstic on all implementations.
-        deps.keys.sort.each do |n|
-          s.add_dependency n, (deps[n] || '>= 0')
-        end
+      # Since Hash#each is unordered in 1.8, sort the keys and iterate that
+      # way so the tests are deterministic on all implementations.
+      deps.keys.sort.each do |n|
+        spec.add_dependency n, (deps[n] || '>= 0')
       end
     end
 
-    quick_spec(name, version, &block)
+    spec.loaded_from = spec.spec_file
+
+    Gem::Specification.add_spec spec
+
+    return spec
   end
 
   ##
@@ -1132,38 +1135,8 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1135
   #   end
 
   def spec_fetcher
-    gems = {}
-
-    fetcher = Object.new
-    fetcher.instance_variable_set :@test,  self
-    fetcher.instance_variable_set :@gems,  gems
-
-    def fetcher.gem name, version, dependencies = nil, &block
-      spec, gem = @test.util_gem name, version, dependencies, &block
-
-      @gems[spec] = gem
-
-      spec
-    end
-
-    def fetcher.spec name, version, dependencies = nil, &block
-      spec = @test.util_spec name, version, dependencies, &block
-
-      @gems[spec] = nil
-
-      spec
-    end
-
-    yield fetcher
-
-    util_setup_fake_fetcher unless @fetcher
-    util_setup_spec_fetcher(*gems.keys)
-
-    gems.each do |spec, gem|
-      next unless gem
-
-      @fetcher.data["http://gems.example.com/gems/#{spec.file_name}"] =
-        Gem.read_binary(gem)
+    Gem::TestCase::SpecFetcherSetup.declare self do |spec_fetcher_setup|
+      yield spec_fetcher_setup if block_given?
     end
   end
 
@@ -1318,3 +1291,6 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1291
   end if defined?(OpenSSL::SSL)
 
 end
+
+require 'rubygems/test_utilities'
+
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 43650)
+++ lib/rubygems.rb	(revision 43651)
@@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8
 require 'rbconfig'
 
 module Gem
-  VERSION = '2.2.0.preview.2'
+  VERSION = '2.2.0'
 end
 
 # Must be first since it unloads the prelude from 1.9.2
Index: lib/rdoc/rubygems_hook.rb
===================================================================
--- lib/rdoc/rubygems_hook.rb	(revision 43650)
+++ lib/rdoc/rubygems_hook.rb	(revision 43651)
@@ -156,6 +156,10 @@ class RDoc::RubygemsHook https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rubygems_hook.rb#L156
     args.concat @spec.require_paths
     args.concat @spec.extra_rdoc_files
 
+    puts
+    p @spec.extra_rdoc_files
+    puts
+
     case config_args = Gem.configuration[:rdoc]
     when String then
       args = args.concat config_args.split
Index: test/rubygems/test_gem_rdoc.rb
===================================================================
--- test/rubygems/test_gem_rdoc.rb	(revision 43650)
+++ test/rubygems/test_gem_rdoc.rb	(revision 43651)
@@ -9,7 +9,7 @@ class TestGemRDoc < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_rdoc.rb#L9
   def setup
     super
 
-    @a = quick_spec 'a' do |s|
+    @a = util_spec 'a' do |s|
       s.rdoc_options = %w[--main MyTitle]
       s.extra_rdoc_files = %w[README]
     end
Index: test/rubygems/test_gem_dependency_resolver_installer_set.rb
===================================================================
--- test/rubygems/test_gem_dependency_resolver_installer_set.rb	(revision 43650)
+++ test/rubygems/test_gem_dependency_resolver_installer_set.rb	(revision 43651)
@@ -4,11 +4,9 @@ require 'rubygems/dependency_resolver' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_dependency_resolver_installer_set.rb#L4
 class TestGemDependencyResolverInstallerSet < Gem::TestCase
 
   def test_load_spec
-    a_2_p = nil
-
-    spec_fetcher do |fetcher|
+    specs = spec_fetcher do |fetcher|
       fetcher.spec 'a', 2
-      a_2_p = fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
+      fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
     end
 
     source = Gem::Source.new @gem_repo
@@ -18,7 +16,7 @@ class TestGemDependencyResolverInstaller https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_dependency_resolver_installer_set.rb#L16
 
     spec = set.load_spec 'a', version, Gem::Platform.local, source
 
-    assert_equal a_2_p.full_name, spec.full_name
+    assert_equal specs["a-2-#{Gem::Platform.local}"].full_name, spec.full_name
   end
 
 end
Index: test/rubygems/test_gem_commands_uninstall_command.rb
===================================================================
--- test/rubygems/test_gem_commands_uninstall_command.rb	(revision 43650)
+++ test/rubygems/test_gem_commands_uninstall_command.rb	(revision 43651)
@@ -24,7 +24,7 @@ class TestGemCommandsUninstallCommand < https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_uninstall_command.rb#L24
 
     gemhome2 = "#{@gemhome}2"
 
-    a_4 = quick_spec 'a', 4
+    a_4 = util_spec 'a', 4
     install_gem a_4, :install_dir => gemhome2
 
     Gem::Specification.dirs = [@gemhome, gemhome2]
@@ -126,7 +126,7 @@ class TestGemCommandsUninstallCommand < https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_uninstall_command.rb#L126
   end
 
   def test_execute_prerelease
-    @spec = quick_spec "pre", "2.b"
+    @spec = util_spec "pre", "2.b"
     @gem = File.join @tempdir, @spec.file_name
     FileUtils.touch @gem
 
@@ -213,7 +213,7 @@ class TestGemCommandsUninstallCommand < https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_uninstall_command.rb#L213
 
     gemhome2 = "#{@gemhome}2"
 
-    a_4 = quick_spec 'a', 4
+    a_4 = util_spec 'a', 4
     install_gem a_4, :install_dir => gemhome2
 
     Gem::Specification.dirs = [@gemhome, gemhome2]
Index: test/rubygems/test_gem_spec_fetcher.rb
===================================================================
--- test/rubygems/test_gem_spec_fetcher.rb	(revision 43650)
+++ test/rubygems/test_gem_spec_fetcher.rb	(revision 43651)
@@ -13,43 +13,7 @@ class TestGemSpecFetcher < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_spec_fetcher.rb#L13
     @uri = URI.parse @gem_repo
     @source = Gem::Source.new(@uri)
 
-    util_setup_fake_fetcher
-
-    @a_pre = new_spec 'a', '1.a'
-
-    install_specs @a_pre
-
-    Gem::Specification.remove_spec @b2
-
-    all = Gem::Specification.map { |spec|
-      Gem::NameTuple.new(spec.name, spec.version, spec.original_platform)
-    }.sort
-
-    @prerelease_specs, @specs = all.partition { |g| g.prerelease? }
-
-    # TODO: couldn't all of this come from the fake spec fetcher?
-    @latest_specs = Gem::Specification.latest_specs.sort.map { |spec|
-      Gem::NameTuple.new(spec.name, spec.version, spec.original_platform)
-    }
-
-    v = Gem.marshal_version
-    s_zip = util_gzip(Marshal.dump(Gem::NameTuple.to_basic(@specs)))
-    l_zip = util_gzip(Marshal.dump(Gem::NameTuple.to_basic(@latest_specs)))
-    p_zip = util_gzip(Marshal.dump(Gem::NameTuple.to_basic(@prerelease_specs)))
-    @fetcher.data["#{@gem_repo}specs.#{v}.gz"]            = s_zip
-    @fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"]     = l_zip
-    @fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
-
     @sf = Gem::SpecFetcher.new
-
-    @released = Gem::NameTuple.from_list \
-                 [["a",      Gem::Version.new("1"),   "ruby"],
-                  ["a",      Gem::Version.new("2"),   "ruby"],
-                  ["a_evil", Gem::Version.new("9"),   "ruby"],
-                  ["c",      Gem::Version.new("1.2"), "ruby"],
-                  ['dep_x',  Gem::Version.new(1),     'ruby'],
-                  ["pl",     Gem::Version.new("1"),   "i386-linux"],
-                  ['x',  Gem::Version.new(1),     'ruby']]
   end
 
   def test_initialize
@@ -86,11 +50,12 @@ class TestGemSpecFetcher < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_spec_fetcher.rb#L50
   end
 
   def test_spec_for_dependency_all
-    d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
-    @fetcher.data["#{d}#{@a1.spec_name}.rz"]    = util_zip(Marshal.dump(@a1))
-    @fetcher.data["#{d}#{@a2.spec_name}.rz"]    = util_zip(Marshal.dump(@a2))
-    @fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
-    @fetcher.data["#{d}#{@a3a.spec_name}.rz"]   = util_zip(Marshal.dump(@a3a))
+    spec_fetcher do |fetcher|
+      fetcher.spec 'a', 1
+      fetcher.spec 'a', '2.a'
+      fetcher.spec 'a', 2
+      fetcher.spec 'a', '3.a'
+    end
 
     dep = Gem::Dependency.new 'a', ">= 1"
 
@@ -100,7 +65,7 @@ class TestGemSpecFetcher < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_spec_fetcher.rb#L65
       [spec.full_name, source_uri]
     end
 
-    expected = [[@a1.full_name, @source], [@a2.full_name, @source]]
+    expected = [['a-1', @source], ['a-2', @source]]
 
     assert_equal expected, spec_names
 
@@ -108,10 +73,11 @@ class TestGemSpecFetcher < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_spec_fetche (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]