mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Allow HOMEBREW_RUBY3 in tests
This commit is contained in:
parent
4ec450823c
commit
14c1dce38b
@ -208,6 +208,7 @@ module Homebrew
|
||||
HOMEBREW_CACHE
|
||||
HOMEBREW_LOGS
|
||||
HOMEBREW_TEMP
|
||||
HOMEBREW_RUBY3
|
||||
]
|
||||
allowed_test_env << "HOMEBREW_USE_RUBY_FROM_PATH" if Homebrew::EnvConfig.developer?
|
||||
Homebrew::EnvConfig::ENVS.keys.map(&:to_s).each do |env|
|
||||
|
@ -9,6 +9,7 @@ describe "RuboCop" do
|
||||
allowlist = %w[
|
||||
HOMEBREW_TESTS
|
||||
HOMEBREW_USE_RUBY_FROM_PATH
|
||||
HOMEBREW_RUBY3
|
||||
]
|
||||
ENV.delete(key) if key.start_with?("HOMEBREW_") && allowlist.exclude?(key)
|
||||
end
|
||||
|
@ -84,6 +84,8 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
||||
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
|
||||
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
|
||||
"HOMEBREW_DEV_CMD_RUN" => "true",
|
||||
"HOMEBREW_USE_RUBY_FROM_PATH" => ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", nil),
|
||||
"HOMEBREW_RUBY3" => ENV.fetch("HOMEBREW_RUBY3", nil),
|
||||
"GEM_HOME" => nil,
|
||||
)
|
||||
|
||||
@ -129,8 +131,12 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
||||
end
|
||||
|
||||
def brew_sh(*args)
|
||||
env = {
|
||||
"HOMEBREW_USE_RUBY_FROM_PATH" => ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", nil),
|
||||
"HOMEBREW_RUBY3" => ENV.fetch("HOMEBREW_RUBY3", nil),
|
||||
}
|
||||
Bundler.with_unbundled_env do
|
||||
stdout, stderr, status = Open3.capture3("#{ENV.fetch("HOMEBREW_PREFIX")}/bin/brew", *args)
|
||||
stdout, stderr, status = Open3.capture3(env, "#{ENV.fetch("HOMEBREW_PREFIX")}/bin/brew", *args)
|
||||
$stdout.print stdout
|
||||
$stderr.print stderr
|
||||
status
|
||||
|
Loading…
x
Reference in New Issue
Block a user