diff --git a/bundler/spec/support/helpers.rb b/bundler/spec/support/helpers.rb index 1ad9cc78ca19..c610b0b40315 100644 --- a/bundler/spec/support/helpers.rb +++ b/bundler/spec/support/helpers.rb @@ -320,10 +320,20 @@ def system_gems(*gems) def install_gem(path, install_dir, default = false) raise "OMG `#{path}` does not exist!" unless File.exist?(path) - args = "--no-document --ignore-dependencies --verbose --local --install-dir #{install_dir}" - args += " --default" if default - - gem_command "install #{args} '#{path}'" + require "rubygems/installer" + installer = Gem::Installer.at( + path, + document: [], + ignore_dependencies: true, + verbose: true, + domain: :local, + install_dir: install_dir, + ) + installer.install + if default + File.delete installer.spec_file + installer.write_default_spec + end end def with_built_bundler(version = nil, &block)