Skip to content

Commit 46084c7

Browse files
committed
Update Ruby::Box context-mode test
1 parent bf32202 commit 46084c7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/irb/test_irb.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,11 @@ class ContextModeTest < TestIRB::IntegrationTestCase
994994
def test_context_mode_ruby_box
995995
omit if RUBY_VERSION < "4.0.0"
996996
@envs['RUBY_BOX'] = '1'
997+
# Ruby::Box now initializes RubyGems per box upstream. Avoid loading bundler context into test execution context.
998+
%w[BUNDLER_SETUP BUNDLER_VERSION BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYOPT].each do |env|
999+
@envs[env] = nil
1000+
end
1001+
@envs['RUBYLIB'] = Gem.loaded_specs.fetch('reline').full_require_paths.join(File::PATH_SEPARATOR)
9971002

9981003
write_rc <<~'RUBY'
9991004
IRB.conf[:CONTEXT_MODE] = 5
@@ -1007,11 +1012,13 @@ def test_context_mode_ruby_box
10071012
RUBY
10081013

10091014
output = run_ruby_file(timeout: TIMEOUT_SEC) do
1015+
type 'p gem_specification: defined?(Gem::Specification)'
10101016
type 'class Integer; def +(_other) = 42; end'
10111017
type 'p answer1: 1 + 2'
10121018
type 'exit'
10131019
end
10141020

1021+
assert_include(output, '{gem_specification: "constant"}')
10151022
assert_include(output, '{answer1: 42}')
10161023
assert_include(output, '{answer2: 3}')
10171024
end

0 commit comments

Comments
 (0)