diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index c1ab26ec10..5ce269d2ec 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -746,7 +746,7 @@ RSpec.describe "bundle gem" do file.puts rakefile end - sys_exec(rake, dir: bundled_app(gem_name)) + sys_exec("rake", dir: bundled_app(gem_name)) expect(out).to include("SUCCESS") end diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb index 6a8de2b949..443971b056 100644 --- a/spec/bundler/runtime/gem_tasks_spec.rb +++ b/spec/bundler/runtime/gem_tasks_spec.rb @@ -66,9 +66,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "includes the relevant tasks" do define_local_gem_using_gem_tasks - with_gem_path_as(scoped_base_system_gem_path.to_s) do - sys_exec "#{rake} -T", env: { "GEM_HOME" => system_gem_path.to_s } - end + sys_exec "rake -T" expect(err).to be_empty expected_tasks = [ @@ -85,9 +83,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "defines a working `rake install` task", :ruby_repo do define_local_gem_using_gem_tasks - with_gem_path_as(scoped_base_system_gem_path.to_s) do - sys_exec "#{rake} install", env: { "GEM_HOME" => system_gem_path.to_s } - end + sys_exec "rake install" expect(err).to be_empty @@ -155,9 +151,8 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "adds 'pkg' to rake/clean's CLOBBER" do define_local_gem_using_gem_tasks - with_gem_path_as(scoped_base_system_gem_path.to_s) do - sys_exec %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect'), env: { "GEM_HOME" => system_gem_path.to_s } - end + sys_exec %(rake -e 'load "Rakefile"; puts CLOBBER.inspect') + expect(out).to eq '["pkg"]' end end diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index acf13c9733..2adabca742 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -196,10 +196,6 @@ module Spec output end - def rake - "#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake" - end - def sys_exec(cmd, options = {}, &block) env = options[:env] || {} env["RUBYOPT"] = opt_add(opt_add("-r#{spec_dir}/support/switch_rubygems.rb", env["RUBYOPT"]), ENV["RUBYOPT"])