* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-11-12 00:16:41 +00:00
parent 8f3934261a
commit 44d0a6dcd7
45 changed files with 1068 additions and 906 deletions

View file

@ -6,7 +6,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
def setup
super
util_setup_fake_fetcher
spec_fetcher
@cmd = Gem::Commands::SourcesCommand.new
@ -18,7 +18,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute
util_setup_spec_fetcher
@cmd.handle_options []
use_ui @ui do
@ -36,9 +35,9 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute_add
util_setup_fake_fetcher
install_specs @a1
spec_fetcher do |fetcher|
fetcher.spec 'a', 1
end
specs = Gem::Specification.map { |spec|
[spec.name, spec.version, spec.original_platform]
@ -54,8 +53,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
@cmd.handle_options %W[--add #{@new_repo}]
util_setup_spec_fetcher
use_ui @ui do
@cmd.execute
end
@ -71,19 +68,13 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute_add_nonexistent_source
util_setup_fake_fetcher
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
@fetcher.data[uri] = proc do
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
end
Gem::RemoteFetcher.fetcher = @fetcher
@cmd.handle_options %w[--add http://beta-gems.example.com]
util_setup_spec_fetcher
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
@cmd.execute
@ -102,8 +93,6 @@ Error fetching http://beta-gems.example.com:
def test_execute_add_redundant_source
@cmd.handle_options %W[--add #{@gem_repo}]
util_setup_spec_fetcher
use_ui @ui do
@cmd.execute
end
@ -120,9 +109,10 @@ source #{@gem_repo} already present in the cache
def test_execute_add_http_rubygems_org
http_rubygems_org = 'http://rubygems.org'
util_setup_fake_fetcher
install_specs @a1
spec_fetcher do |fetcher|
fetcher.spec 'a', 1
end
specs = Gem::Specification.map { |spec|
[spec.name, spec.version, spec.original_platform]
@ -138,8 +128,6 @@ source #{@gem_repo} already present in the cache
@cmd.handle_options %W[--add #{http_rubygems_org}]
util_setup_spec_fetcher
ui = Gem::MockGemUi.new "n"
use_ui ui do
@ -160,8 +148,6 @@ source #{@gem_repo} already present in the cache
def test_execute_add_bad_uri
@cmd.handle_options %w[--add beta-gems.example.com]
util_setup_spec_fetcher
use_ui @ui do
assert_raises Gem::MockGemUi::TermError do
@cmd.execute
@ -181,8 +167,6 @@ beta-gems.example.com is not a URI
def test_execute_clear_all
@cmd.handle_options %w[--clear-all]
util_setup_spec_fetcher
use_ui @ui do
@cmd.execute
end
@ -218,8 +202,6 @@ beta-gems.example.com is not a URI
def test_execute_remove
@cmd.handle_options %W[--remove #{@gem_repo}]
util_setup_spec_fetcher
use_ui @ui do
@cmd.execute
end
@ -233,8 +215,6 @@ beta-gems.example.com is not a URI
def test_execute_remove_no_network
@cmd.handle_options %W[--remove #{@gem_repo}]
util_setup_fake_fetcher
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
raise Gem::RemoteFetcher::FetchError
end
@ -252,22 +232,9 @@ beta-gems.example.com is not a URI
def test_execute_update
@cmd.handle_options %w[--update]
util_setup_fake_fetcher
util_setup_spec_fetcher @a1
specs = Gem::Specification.map { |spec|
[spec.name, spec.version, spec.original_platform]
}
@fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] =
util_gzip Marshal.dump(specs)
latest_specs = Gem::Specification.latest_specs.map { |spec|
[spec.name, spec.version, spec.original_platform]
}
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] =
util_gzip Marshal.dump(latest_specs)
spec_fetcher do |fetcher|
fetcher.gem 'a', 1
end
use_ui @ui do
@cmd.execute