aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_unpack_command.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-01 03:11:34 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-01 03:11:34 +0000
commitec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513 (patch)
treecc3b9df7f06f86c52f4d09c03f5c9a3876c87b67 /test/rubygems/test_gem_commands_unpack_command.rb
parentf4234c9b8f4707c5979d9a3beddc19ceeb417bd8 (diff)
downloadruby-ec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513.tar.gz
Import rubygems 1.5.0 (released version @ 1fb59d0)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30752 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.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb
index e8d7984c65..0fb4ef3843 100644
--- a/test/rubygems/test_gem_commands_unpack_command.rb
+++ b/test/rubygems/test_gem_commands_unpack_command.rb
@@ -17,6 +17,46 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
+ def test_find_in_cache
+ util_make_gems
+
+ assert_equal(
+ @cmd.find_in_cache(@a1.file_name),
+ File.join(@gemhome, 'cache', @a1.file_name),
+ 'found a-1.gem in the cache'
+ )
+ end
+
+ def test_get_path
+ util_make_gems
+ util_setup_fake_fetcher
+ util_setup_spec_fetcher @a1
+
+ a1_data = nil
+
+ open File.join(@gemhome, 'cache', @a1.file_name), 'rb' do |fp|
+ a1_data = fp.read
+ end
+
+ Gem::RemoteFetcher.fetcher.data['http://gems.example.com/gems/a-1.gem'] =
+ a1_data
+
+ dep = Gem::Dependency.new(@a1.name, @a1.version)
+ assert_equal(
+ @cmd.get_path(dep),
+ File.join(@gemhome, 'cache', @a1.file_name),
+ 'fetches a-1 and returns the cache path'
+ )
+
+ FileUtils.rm File.join(@gemhome, 'cache', @a1.file_name)
+
+ assert_equal(
+ @cmd.get_path(dep),
+ File.join(@gemhome, 'cache', @a1.file_name),
+ 'when removed from cache, refetches a-1'
+ )
+ end
+
def test_execute
util_make_gems