aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_unpack_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_unpack_command.rb
parent8f3934261ad4a7f486d2fffa9c961d7535675d8f (diff)
downloadruby-44d0a6dcd7563526a8b05ccdfa21d9425b94e62b.tar.gz
* 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_unpack_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb46
1 files changed, 16 insertions, 30 deletions
diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb
index 183a7e67c0..59f6cc6c74 100644
--- a/test/rubygems/test_gem_commands_unpack_command.rb
+++ b/test/rubygems/test_gem_commands_unpack_command.rb
@@ -22,31 +22,22 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_get_path
- util_setup_fake_fetcher
- util_clear_gems
- util_setup_spec_fetcher @a1
-
- a1_data = nil
-
- open @a1.cache_file, 'rb' do |fp|
- a1_data = fp.read
+ specs = spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
end
- Gem::RemoteFetcher.fetcher.data['http://gems.example.com/gems/a-1.gem'] =
- a1_data
-
- dep = Gem::Dependency.new(@a1.name, @a1.version)
+ dep = Gem::Dependency.new 'a', 1
assert_equal(
@cmd.get_path(dep),
- @a1.cache_file,
+ specs['a-1'].cache_file,
'fetches a-1 and returns the cache path'
)
- FileUtils.rm @a1.cache_file
+ FileUtils.rm specs['a-1'].cache_file
assert_equal(
@cmd.get_path(dep),
- @a1.cache_file,
+ specs['a-1'].cache_file,
'when removed from cache, refetches a-1'
)
end
@@ -67,8 +58,9 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_gem_path
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', '3.a'
+ end
Gem.clear_paths
@@ -88,8 +80,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_gem_path_missing
- util_setup_fake_fetcher
- util_setup_spec_fetcher
+ spec_fetcher
Gem.clear_paths
@@ -109,18 +100,13 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_remote
- util_setup_fake_fetcher
- util_setup_spec_fetcher @a1, @a2
- util_clear_gems
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 1
+ fetcher.gem 'a', 2
- a2_data = nil
- open @a2.cache_file, 'rb' do |fp|
- a2_data = fp.read
+ fetcher.clear
end
- Gem::RemoteFetcher.fetcher.data['http://gems.example.com/gems/a-2.gem'] =
- a2_data
-
Gem.configuration.verbose = :really
@cmd.options[:args] = %w[a]
@@ -186,8 +172,8 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
def test_execute_exact_match
- foo_spec = quick_spec 'foo'
- foo_bar_spec = quick_spec 'foo_bar'
+ foo_spec = util_spec 'foo'
+ foo_bar_spec = util_spec 'foo_bar'
use_ui @ui do
Dir.chdir @tempdir do