1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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

@ -12,15 +12,13 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
def test_execute
util_setup_fake_fetcher
util_setup_spec_fetcher @a2
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
File.read(@a2.cache_file)
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 2
end
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
@cmd.options[:args] = [@a2.name]
@cmd.options[:args] = %w[a]
use_ui @ui do
Dir.chdir @tempdir do
@ -28,24 +26,23 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
assert_path_exists(File.join(@tempdir, @a2.file_name),
"#{@a2.full_name} not fetched")
a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
refute_path_exists File.join(@tempdir, 'cache'),
'gem repository directories must not be created'
end
def test_execute_latest
util_setup_fake_fetcher
util_setup_spec_fetcher @a1, @a2
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
File.read(@a1.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
File.read(@a2.cache_file)
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 1
fetcher.gem 'a', 2
end
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
@cmd.options[:args] = [@a2.name]
@cmd.options[:args] = %w[a]
@cmd.options[:version] = req('>= 0.1')
use_ui @ui do
@ -54,23 +51,20 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
assert_path_exists(File.join(@tempdir, @a2.file_name),
"#{@a2.full_name} not fetched")
a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
refute_path_exists File.join(@tempdir, 'cache'),
'gem repository directories must not be created'
end
def test_execute_prerelease
util_setup_fake_fetcher true
util_clear_gems
util_setup_spec_fetcher @a2, @a2_pre
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 2
fetcher.gem 'a', '2.a'
end
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
File.read(@a2.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
File.read(@a2_pre.cache_file)
@cmd.options[:args] = [@a2.name]
@cmd.options[:args] = %w[a]
@cmd.options[:prerelease] = true
use_ui @ui do
@ -79,21 +73,19 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
assert_path_exists(File.join(@tempdir, @a2.file_name),
"#{@a2.full_name} not fetched")
a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
end
def test_execute_specific_prerelease
util_setup_fake_fetcher true
util_clear_gems
util_setup_spec_fetcher @a2, @a2_pre
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 2
fetcher.gem 'a', '2.a'
end
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
File.read(@a2.cache_file)
@fetcher.data["#{@gem_repo}gems/#{@a2_pre.file_name}"] =
File.read(@a2_pre.cache_file)
@cmd.options[:args] = [@a2.name]
@cmd.options[:args] = %w[a]
@cmd.options[:prerelease] = true
@cmd.options[:version] = "2.a"
@ -103,18 +95,19 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
assert_path_exists(File.join(@tempdir, @a2_pre.file_name),
"#{@a2_pre.full_name} not fetched")
a2_pre = specs['a-2.a']
assert_path_exists(File.join(@tempdir, a2_pre.file_name),
"#{a2_pre.full_name} not fetched")
end
def test_execute_version
util_setup_fake_fetcher
util_setup_spec_fetcher @a1, @a2
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 1
fetcher.gem 'a', 2
end
@fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
File.read(@a1.cache_file)
@cmd.options[:args] = [@a2.name]
@cmd.options[:args] = %w[a]
@cmd.options[:version] = Gem::Requirement.new '1'
use_ui @ui do
@ -123,8 +116,10 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
assert_path_exists(File.join(@tempdir, @a1.file_name),
"#{@a1.full_name} not fetched")
a1 = specs['a-1']
assert_path_exists(File.join(@tempdir, a1.file_name),
"#{a1.full_name} not fetched")
end
end