diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-03-11 19:25:44 +0900 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-11 17:42:58 -0700 |
| commit | efca0f45203d5908b3ec155b40e59baa8504f0ae (patch) | |
| tree | 496996e3cf4e2358bc47d95f2377921badaea9f3 | |
| parent | 9bcd9ba9b31fea19dc56bc2f5c69cf584d3bd23c (diff) | |
Use $LOAD_PATH.replace for safer restoration in test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| -rw-r--r-- | test/test_bundled_gems.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/test_bundled_gems.rb b/test/test_bundled_gems.rb index 8cb4232b09..0889584185 100644 --- a/test/test_bundled_gems.rb +++ b/test/test_bundled_gems.rb @@ -61,11 +61,12 @@ class TestBundlerGem < Gem::TestCase Dir.mktmpdir do |dir| FileUtils.mkdir_p(File.join(dir, "benchmark")) File.write(File.join(dir, "benchmark", "ips.rb"), "") + original_load_path = $LOAD_PATH.dup $LOAD_PATH.unshift(dir) begin assert_nil Gem::BUNDLED_GEMS.warning?("benchmark/ips", specs: {}) ensure - $LOAD_PATH.shift + $LOAD_PATH.replace(original_load_path) end end end |
