From 44f7f093ab8d8663cbbe31d8a975ae6e8d20724f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sun, 9 Jun 2019 11:00:07 +0900 Subject: [PATCH] Added the condition for ruby_core repository. --- spec/bundler/bundler/shared_helpers_spec.rb | 10 +++++++++- spec/bundler/commands/exec_spec.rb | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb index 8e82d1b910..a040c291d9 100644 --- a/spec/bundler/bundler/shared_helpers_spec.rb +++ b/spec/bundler/bundler/shared_helpers_spec.rb @@ -223,6 +223,14 @@ RSpec.describe Bundler::SharedHelpers do ENV["BUNDLE_GEMFILE"] = "Gemfile" end + let(:setup_path) do + if ruby_core? + File.expand_path("../../../lib/bundler/setup", __dir__) + else + File.expand_path("../../lib/bundler/setup", __dir__) + end + end + shared_examples_for "ENV['PATH'] gets set correctly" do before { Dir.mkdir ".bundle" } @@ -236,7 +244,7 @@ RSpec.describe Bundler::SharedHelpers do shared_examples_for "ENV['RUBYOPT'] gets set correctly" do it "ensures -rbundler/setup is at the beginning of ENV['RUBYOPT']" do subject.set_bundle_environment - expect(ENV["RUBYOPT"].split(" ")).to start_with("-r#{File.expand_path("../../lib/bundler/setup", __dir__)}") + expect(ENV["RUBYOPT"].split(" ")).to start_with("-r#{setup_path}") end end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 8f49c576b5..fe5cb9f50c 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -279,7 +279,12 @@ RSpec.describe "bundle exec" do G rubyopt = ENV["RUBYOPT"] - rubyopt = "-r#{File.expand_path("../../lib/bundler/setup", __dir__)} #{rubyopt}" + setup_path = if ruby_core? + File.expand_path("../../../lib/bundler/setup", __dir__) + else + File.expand_path("../../lib/bundler/setup", __dir__) + end + rubyopt = "-r#{setup_path} #{rubyopt}" bundle "exec 'echo $RUBYOPT'" expect(out).to have_rubyopts(rubyopt)