Skip to content

Conversation

@afurm
Copy link
Member

@afurm afurm commented Dec 28, 2025

Problem

The gem which command reports the filesystem path for a requireable file; test_execute_one_missing verifies it prints the found path and errors on a missing file. The test fails when run in isolation because it relies on gem path/spec state set by other tests.

Fix

Set GEM_HOME/GEM_PATH to @gemhome, call Gem.use_paths(@gemhome), and reset the spec cache before the test runs. Restore the env and gem paths in an ensure block and reset the spec cache afterward.

Testing

  • ruby -Ilib:test:bundler/lib test/rubygems/test_gem_commands_which_command.rb -n test_execute_one_missing

@afurm afurm force-pushed the fix-which-command-test-isolation branch from 55c51d4 to bf8c2a3 Compare December 28, 2025 10:13
@afurm afurm force-pushed the fix-which-command-test-isolation branch from bf8c2a3 to 0420c70 Compare December 28, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant