Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RUBYOPT's handling in tests #1097

Merged
merged 1 commit into from
Dec 17, 2024
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
13 changes: 7 additions & 6 deletions test/support/console_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ def prepare_test_environment(program, test_steps, &block)
@scenario = []
test_steps.call
@scenario.freeze
inject_lib_to_load_path

ENV['RUBYOPT'] = "-I #{__dir__}/../../lib"

if ENV.key?('BUNDLE_GEMFILE')
ENV["RUBYOPT"] += " -rbundler/setup"
end

block.call

Expand Down Expand Up @@ -283,7 +288,7 @@ def run_rdbg program, options: nil, rubyopt: nil, &test_steps
prepare_test_environment(program, test_steps) do
test_info = TestInfo.new(dup_scenario, 'LOCAL', /\(rdbg\)/)
cmd = "#{RDBG_EXECUTABLE} #{options} -- #{temp_file_path}"
cmd = "RUBYOPT=#{rubyopt} #{cmd}" if rubyopt
ENV["RUBYOPT"] += " #{rubyopt}" if rubyopt
run_test_scenario cmd, test_info
end
end
Expand All @@ -301,10 +306,6 @@ def new_thread &block
end
end

def inject_lib_to_load_path
ENV['RUBYOPT'] = "-I #{__dir__}/../../lib"
end

def assert_empty_queue test_info, exception: nil
message = "Expected all commands/assertions to be executed. Still have #{test_info.queue.length} left."
if exception
Expand Down
Loading