summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_fetch_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-12 00:16:41 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-12 00:16:41 +0000
commit44d0a6dcd7563526a8b05ccdfa21d9425b94e62b (patch)
treee3bc8e5f1284e65a70c61de9a9d349d5fc8a8640 /test/rubygems/test_gem_commands_fetch_command.rb
parent8f3934261ad4a7f486d2fffa9c961d7535675d8f (diff)
* 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
Diffstat (limited to 'test/rubygems/test_gem_commands_fetch_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb91
1 files changed, 43 insertions, 48 deletions
diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb
index 364881a132..c452e79f14 100644
--- a/test/rubygems/test_gem_commands_fetch_command.rb
+++ b/test/rubygems/test_gem_commands_fetch_command.rb
@@ -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
-
- @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)
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.a'
+ end
- @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
-
- @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)
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 2
+ fetcher.gem 'a', '2.a'
+ end
- @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
-
- @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
- File.read(@a1.cache_file)
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ fetcher.gem 'a', 2
+ end
- @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