[rubygems/rubygems] Replace shell specific stuff with create_file scripts

https://github.com/rubygems/rubygems/commit/eea07ad691
This commit is contained in:
sodacris 2024-12-04 20:41:35 +08:00 committed by git
parent 0be06552a8
commit a7383fc7f4

View File

@ -311,8 +311,7 @@ RSpec.describe "bundle exec" do
end
it "does not duplicate already exec'ed RUBYOPT" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
create_file("echoopt", "#!/usr/bin/env ruby\nprint ENV['RUBYOPT']")
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@ -322,16 +321,15 @@ RSpec.describe "bundle exec" do
rubyopt = opt_add(bundler_setup_opt, ENV["RUBYOPT"])
bundle "exec 'echo $RUBYOPT'"
bundle "exec echoopt"
expect(out.split(" ").count(bundler_setup_opt)).to eq(1)
bundle "exec 'echo $RUBYOPT'", env: { "RUBYOPT" => rubyopt }
bundle "exec echoopt", env: { "RUBYOPT" => rubyopt }
expect(out.split(" ").count(bundler_setup_opt)).to eq(1)
end
it "does not duplicate already exec'ed RUBYLIB" do
skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
create_file("echolib", "#!/usr/bin/env ruby\nprint ENV['RUBYLIB']")
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@ -341,10 +339,10 @@ RSpec.describe "bundle exec" do
rubylib = rubylib.to_s.split(File::PATH_SEPARATOR).unshift lib_dir.to_s
rubylib = rubylib.uniq.join(File::PATH_SEPARATOR)
bundle "exec 'echo $RUBYLIB'"
bundle "exec echolib"
expect(out).to include(rubylib)
bundle "exec 'echo $RUBYLIB'", env: { "RUBYLIB" => rubylib }
bundle "exec echolib", env: { "RUBYLIB" => rubylib }
expect(out).to include(rubylib)
end
@ -366,7 +364,7 @@ RSpec.describe "bundle exec" do
gem "myrack"
G
bundle "exec touch foo"
bundled_app("foo").write("")
bundle "exec ./foo", raise_on_error: false
expect(exitstatus).to eq(126)
expect(err).to include("bundler: not executable: ./foo")
@ -453,7 +451,7 @@ RSpec.describe "bundle exec" do
it "shows bundle-exec's man page when --help is between exec and the executable" do
with_fake_man do
bundle "#{exec} --help cat"
bundle "#{exec} --help echo"
end
expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end