diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-11-10 19:39:48 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-12-13 12:16:55 +0900 |
| commit | 7d5d2eef78d57bfac75b68c08e4bf5ce3d633a01 (patch) | |
| tree | a2a83ca153a82de89ed40ed29bd5c955cdd4fa9f /spec | |
| parent | 8d1a2036643faecf55b9c09d6b788d1cd3b1f064 (diff) | |
[rubygems/rubygems] Load hax.rb before anything when `BUNDLER_IGNORE_DEFAULT_GEM` set
https://github.com/rubygems/rubygems/commit/111bd11c36
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/support/helpers.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 31b4f64d63..dc401eab55 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -116,7 +116,7 @@ module Spec end end.join - ruby_cmd = build_ruby_cmd({ load_path: load_path, requires: requires }) + ruby_cmd = build_ruby_cmd({ load_path: load_path, requires: requires, env: env }) cmd = "#{ruby_cmd} #{bundle_bin} #{cmd}#{args}" sys_exec(cmd, { env: env, dir: dir, raise_on_error: raise_on_error }, &block) end @@ -147,7 +147,13 @@ module Spec lib_option = libs ? "-I#{libs.join(File::PATH_SEPARATOR)}" : [] requires = options.delete(:requires) || [] - requires << "#{Path.spec_dir}/support/hax.rb" + + hax_path = "#{Path.spec_dir}/support/hax.rb" + + # For specs that need to ignore the default Bundler gem, load hax before + # anything else since other stuff may actually load bundler and not skip + # the default version + options[:env]&.include?("BUNDLER_IGNORE_DEFAULT_GEM") ? requires.prepend(hax_path) : requires.append(hax_path) require_option = requires.map {|r| "-r#{r}" } [Gem.ruby, *lib_option, *require_option].compact.join(" ") |
