diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 6a20f51958..4427eeb873 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -52,7 +52,7 @@ module Gem::BUNDLED_GEMS WARNED = {} # unfrozen conf = ::RbConfig::CONFIG - if !File.exist?(conf["rubylibdir"]) + if ENV["TEST_BUNDLED_GEMS"] LIBDIR = (File.expand_path(File.join(__dir__, "..", "lib")) + "/").freeze else LIBDIR = (conf["rubylibdir"] + "/").freeze diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb index 746a7c695b..f2f908b341 100644 --- a/spec/bundler/bundled_gems_spec.rb +++ b/spec/bundler/bundled_gems_spec.rb @@ -1,6 +1,8 @@ require "bundled_gems" RSpec.describe "bundled_gems.rb" do + ENV["TEST_BUNDLED_GEMS"] = "true" + def script(code, options = {}) options[:artifice] ||= "compact_index" ruby("require 'bundler/inline'\n\n" + code, options)