diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 4a0a07244c..a46292665b 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -314,14 +314,18 @@ module Spec "#{gem_repo}/gems/#{g}.gem" end - raise "OMG `#{path}` does not exist!" unless File.exist?(path) - - gem_command! :install, "--no-document --ignore-dependencies '#{path}'" + install_gem(path) bundler_path && bundler_path.rmtree end end + def install_gem(path) + raise "OMG `#{path}` does not exist!" unless File.exist?(path) + + gem_command! :install, "--no-document --ignore-dependencies '#{path}'" + end + def with_gem_path_as(path) backup = ENV.to_hash ENV["GEM_HOME"] = path.to_s