rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 1.99k forks source link

Fix flaky spec failure #7594

Closed deivid-rodriguez closed 4 years ago

deivid-rodriguez commented 4 years ago

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 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.

deivid-rodriguez commented 4 years ago

@bundlerbot merge

ghost commented 4 years ago

Build succeeded