diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-28 02:02:37 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-28 02:02:37 +0000 |
commit | 6cc4937aec6596bff58fc946b4b00c7b546e494a (patch) | |
tree | ca3f5b6f726b9be0596353d8a29d095b67619e7b /lib/rubygems/test_case.rb | |
parent | 7d378a5b3adefa8d3ab3b436a382daeb018d99ef (diff) |
* lib/rubygems/test_case.rb: Fix test on Windows for inconsistent temp path.
https://github.com/rubygems/rubygems/pull/1554
[Bug #12193][ruby-core:74431]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r-- | lib/rubygems/test_case.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 0864f33478..bde4ed6713 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -252,6 +252,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase @tempdir.untaint end + # This makes the tempdir consistent on Windows. + # Dir.tmpdir may return short path name, but Dir[Dir.tmpdir] returns long + # path name. https://bugs.ruby-lang.org/issues/10819 + # File.expand_path or File.realpath doesn't convert path name to long path + # name. Only Dir[] (= Dir.glob) works. + # Short and long path name is specific to Windows filesystem. + if win_platform? + @tempdir = Dir[@tempdir][0] + @tempdir.untaint + end + @gemhome = File.join @tempdir, 'gemhome' @userhome = File.join @tempdir, 'userhome' ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache' |