What is your fix for the problem, implemented in this PR?
My diagnosis was that if our test code happens to run Gem.configuration before ENV["HOME"] is changed for our tests, this test starts failing because the test first writes to the global ~/.gemrc file (not in tmp/), because Gem.config_file has that value memoized. Then, however, the bundle install subprocess infers Gem.config_file from the modified ENV["HOME"] and tries to read tmp/home/.gemrc. However, that file doesn't exist, so rubygems configuration is ignored and doesn't print an error like the test expects.
My fix is to make this test independent from the specific rubygems configuration in the main test process.
What was the end-user or developer problem that led to this PR?
The problem was flaky tests: https://www.travis-ci.org/rubygems/bundler/jobs/639403049.
What is your fix for the problem, implemented in this PR?
My diagnosis was that if our test code happens to run
Gem.configuration
beforeENV["HOME"]
is changed for our tests, this test starts failing because the test first writes to the global~/.gemrc
file (not intmp/
), becauseGem.config_file
has that value memoized. Then, however, thebundle install
subprocess infersGem.config_file
from the modifiedENV["HOME"]
and tries to readtmp/home/.gemrc
. However, that file doesn't exist, so rubygems configuration is ignored and doesn't print an error like the test expects.My fix is to make this test independent from the specific rubygems configuration in the main test process.