From ec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 1 Feb 2011 03:11:34 +0000 Subject: 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 --- test/rubygems/test_gem_commands_unpack_command.rb | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/rubygems/test_gem_commands_unpack_command.rb') 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 -- cgit v1.2.3