[rubygems/rubygems] Fix some specs running the wrong rake

8d4eb154b1
This commit is contained in:
David Rodríguez 2025-07-23 19:16:00 +02:00 committed by Hiroshi SHIBATA
parent e673bbf77b
commit b78406a032
3 changed files with 5 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -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"])