summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-22 21:43:44 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-22 21:43:44 +0000
commit4cdb64316cc89c6a4b2be2ddafda46aaf87fc36b (patch)
tree8f7fcd6e5e12762965659d1279b3f89a8f09187a /lib/rubygems
parentddb9c34d16093723b961bf33eb2b62f20655a38e (diff)
* lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead
of ./tmp/test. Fixes [ruby-trunk - Bug #7717] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/test_case.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index a04c733ccf..9776fb55b9 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -118,8 +118,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@current_dir = Dir.pwd
@ui = Gem::MockGemUi.new
- # Need to do this in the project because $SAFE fucks up _everything_
- tmpdir = File.expand_path("tmp/test")
+ tmpdir = File.expand_path Dir.tmpdir
+ tmpdir.untaint
if ENV['KEEP_FILES'] then
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
@@ -127,6 +127,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
end
@tempdir.untaint
+
+ FileUtils.mkdir_p @tempdir
+
+ # This makes the tempdir consistent on OS X.
+ # File.expand_path Dir.tmpdir #=> "/var/..."
+ # Dir.chdir Dir.tmpdir do File.expand_path '.' end #=> "/private/var/..."
+ Dir.chdir @tempdir do
+ @tempdir = File.expand_path '.'
+ @tempdir.untaint
+ end
+
@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'