aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_remote_fetcher.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-07 08:44:45 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-07 08:44:45 +0000
commit1df42597d15416357a20bd68700ce1a2d245e8bb (patch)
treef588f28559958e27464866d7b137955bfff04a6f /test/rubygems/test_gem_remote_fetcher.rb
parentfc634cc092f486adfc911f614b7b4aa2c48c698d (diff)
downloadruby-1df42597d15416357a20bd68700ce1a2d245e8bb.tar.gz
cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_remote_fetcher.rb')
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb37
1 files changed, 23 insertions, 14 deletions
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