File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,7 @@ def sha512_hexdigest(path)
386386 credentials = double ( "credentials" , "file?" => true )
387387 allow ( Bundler . user_home ) . to receive ( :join ) .
388388 with ( ".gem/credentials" ) . and_return ( credentials )
389+ allow ( Bundler . user_home ) . to receive ( :join ) . and_call_original
389390 end
390391
391392 describe "success messaging" do
Original file line number Diff line number Diff line change @@ -114,7 +114,17 @@ def tmp(*path)
114114 end
115115
116116 def tmp_root
117- ruby_core? && ( tmpdir = ENV [ "TMPDIR" ] ) ? Pathname ( tmpdir ) : source_root . join ( "tmp" )
117+ if ruby_core? && ( tmpdir = ENV [ "TMPDIR" ] )
118+ # Use realpath to resolve any symlinks in TMPDIR (e.g., on macOS /var -> /private/var)
119+ real = begin
120+ File . realpath ( tmpdir )
121+ rescue Errno ::ENOENT , Errno ::EACCES
122+ tmpdir
123+ end
124+ Pathname ( real )
125+ else
126+ source_root . join ( "tmp" )
127+ end
118128 end
119129
120130 # Bump this version whenever you make a breaking change to the spec setup
Original file line number Diff line number Diff line change @@ -43,7 +43,18 @@ def test_setup
4343 # sign extension bundles on macOS, to avoid trying to find the specified key
4444 # from the fake $HOME/Library/Keychains directory.
4545 ENV . delete "RUBY_CODESIGN"
46- ENV [ "TMPDIR" ] = Path . tmpdir . to_s unless Path . ruby_core?
46+ if Path . ruby_core?
47+ if ( tmpdir = ENV [ "TMPDIR" ] )
48+ tmpdir_real = begin
49+ File . realpath ( tmpdir )
50+ rescue Errno ::ENOENT , Errno ::EACCES
51+ tmpdir
52+ end
53+ ENV [ "TMPDIR" ] = tmpdir_real if tmpdir_real != tmpdir
54+ end
55+ else
56+ ENV [ "TMPDIR" ] = Path . tmpdir . to_s
57+ end
4758
4859 require "rubygems/user_interaction"
4960 Gem ::DefaultUserInteraction . ui = Gem ::SilentUI . new
You can’t perform that action at this time.
0 commit comments