Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/irb/test_irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -994,11 +994,18 @@ class ContextModeTest < TestIRB::IntegrationTestCase
def test_context_mode_ruby_box
omit if RUBY_VERSION < "4.0.0"
@envs['RUBY_BOX'] = '1'
# Ruby::Box now initializes RubyGems per box upstream. Avoid loading bundler context into test execution context.
%w[BUNDLER_SETUP BUNDLER_VERSION BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYOPT].each do |env|
@envs[env] = nil
# bundler/setup loaded via RUBYOPT fails inside Ruby::Box (Ruby::Box
# initializes RubyGems per box, and Gem::Specification is not defined when
# Bundler evaluates irb.gemspec), so remove the bundler context from the
# child process. Keep the env intact when not under bundler: in ruby/ruby's
# test-bundled-gems, inherited RUBYOPT/RUBYLIB carry the build-tree load
# paths without which the child cannot require prism.
if ENV['RUBYOPT']&.include?('bundler/setup')
%w[BUNDLER_SETUP BUNDLER_VERSION BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYOPT].each do |env|
@envs[env] = nil
end
@envs['RUBYLIB'] = Gem.loaded_specs.fetch('reline').full_require_paths.join(File::PATH_SEPARATOR)
end
@envs['RUBYLIB'] = Gem.loaded_specs.fetch('reline').full_require_paths.join(File::PATH_SEPARATOR)

write_rc <<~'RUBY'
IRB.conf[:CONTEXT_MODE] = 5
Expand Down