From 25a9b62d45ddd60a231272567c7dda9337da9b62 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 1 Mar 2011 09:41:32 +0000 Subject: Import rubygems 1.6.0 (released version @ 58d8a0b9) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_remote_fetcher.rb | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'test/rubygems/test_gem_remote_fetcher.rb') diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index 135b2c7e53..66fb682c6c 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -99,9 +99,10 @@ gems: # REFACTOR: copied from test_gem_dependency_installer.rb @gems_dir = File.join @tempdir, 'gems' - @cache_dir = File.join @gemhome, 'cache' + @cache_dir = Gem.cache_dir(@gemhome) FileUtils.mkdir @gems_dir + # TODO: why does the remote fetcher need it written to disk? @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end Gem::RemoteFetcher.fetcher = nil @@ -208,7 +209,7 @@ gems: fetcher = util_fuck_with_fetcher a1_data - a1_cache_gem = File.join(@gemhome, 'cache', @a1.file_name) + a1_cache_gem = Gem.cache_gem(@a1.file_name, @gemhome) assert_equal a1_cache_gem, fetcher.download(@a1, 'http://gems.example.com') assert_equal("http://gems.example.com/gems/a-1.gem", fetcher.instance_variable_get(:@test_arg).to_s) @@ -220,7 +221,7 @@ gems: inst = Gem::RemoteFetcher.fetcher - assert_equal File.join(@gemhome, 'cache', @a1.file_name), + assert_equal Gem.cache_gem(@a1.file_name, @gemhome), inst.download(@a1, 'http://gems.example.com') end @@ -233,7 +234,7 @@ gems: inst = Gem::RemoteFetcher.fetcher end - assert_equal File.join(@gemhome, 'cache', @a1.file_name), + assert_equal Gem.cache_gem(@a1.file_name, @gemhome), inst.download(@a1, local_path) end @@ -248,7 +249,7 @@ gems: inst = Gem::RemoteFetcher.fetcher end - assert_equal File.join(@gemhome, 'cache', @a1.file_name), + assert_equal Gem.cache_gem(@a1.file_name, @gemhome), inst.download(@a1, local_path) end @@ -262,7 +263,7 @@ gems: install_dir = File.join @tempdir, 'more_gems' - a1_cache_gem = File.join install_dir, 'cache', @a1.file_name + a1_cache_gem = Gem.cache_gem(@a1.file_name, install_dir) FileUtils.mkdir_p(File.dirname(a1_cache_gem)) actual = fetcher.download(@a1, 'http://gems.example.com', install_dir) @@ -278,7 +279,7 @@ gems: FileUtils.mv @a1_gem, @tempdir local_path = File.join @tempdir, @a1.file_name inst = nil - File.chmod 0555, File.join(@gemhome, 'cache') + File.chmod 0555, Gem.cache_dir(@gemhome) Dir.chdir @tempdir do inst = Gem::RemoteFetcher.fetcher @@ -287,19 +288,19 @@ gems: assert_equal File.join(@tempdir, @a1.file_name), inst.download(@a1, local_path) ensure - File.chmod 0755, File.join(@gemhome, 'cache') + File.chmod 0755, Gem.cache_dir(@gemhome) end def test_download_read_only - File.chmod 0555, File.join(@gemhome, 'cache') + File.chmod 0555, Gem.cache_dir(@gemhome) File.chmod 0555, File.join(@gemhome) fetcher = util_fuck_with_fetcher File.read(@a1_gem) fetcher.download(@a1, 'http://gems.example.com') - assert File.exist?(File.join(Gem.user_dir, 'cache', @a1.file_name)) + assert File.exist?(Gem.cache_gem(@a1.file_name, Gem.user_dir)) ensure - File.chmod 0755, File.join(@gemhome) - File.chmod 0755, File.join(@gemhome, 'cache') + File.chmod 0755, @gemhome + File.chmod 0755, Gem.cache_dir(@gemhome) end end @@ -318,7 +319,7 @@ gems: fetcher = util_fuck_with_fetcher e1_data, :blow_chunks - e1_cache_gem = File.join(@gemhome, 'cache', e1.file_name) + e1_cache_gem = Gem.cache_gem(e1.file_name, @gemhome) assert_equal e1_cache_gem, fetcher.download(e1, 'http://gems.example.com') @@ -336,7 +337,7 @@ gems: inst = Gem::RemoteFetcher.fetcher end - cache_path = File.join @gemhome, 'cache', @a1.file_name + cache_path = Gem.cache_gem(@a1.file_name, @gemhome) FileUtils.mv local_path, cache_path gem = Gem::Format.from_file_by_path cache_path @@ -744,5 +745,13 @@ gems: end end + def test_correct_for_windows_path + path = "/C:/WINDOWS/Temp/gems" + assert_equal "C:/WINDOWS/Temp/gems", @fetcher.correct_for_windows_path(path) + + path = "/home/skillet" + assert_equal "/home/skillet", @fetcher.correct_for_windows_path(path) + end + end -- cgit v1.2.3