From 6cc4937aec6596bff58fc946b4b00c7b546e494a Mon Sep 17 00:00:00 2001 From: hsbt Date: Mon, 28 Mar 2016 02:02:37 +0000 Subject: * 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 --- lib/rubygems/test_case.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/rubygems/test_case.rb') 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' -- cgit v1.2.3