File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -320,12 +320,11 @@ def bundler_ruby_lib
320320 end
321321
322322 def clean_load_path
323- bundler_lib = bundler_ruby_lib
324-
325323 loaded_gem_paths = Bundler . rubygems . loaded_gem_paths
326324
327325 $LOAD_PATH. reject! do |p |
328- next if resolve_path ( p ) . start_with? ( bundler_lib )
326+ resolved_path = resolve_path ( p )
327+ next if $LOADED_FEATURES. any? { |lf | lf . start_with? ( resolved_path ) }
329328 loaded_gem_paths . delete ( p )
330329 end
331330 $LOAD_PATH. uniq!
Original file line number Diff line number Diff line change @@ -1511,5 +1511,28 @@ def lock_with(ruby_version = nil)
15111511
15121512 expect ( out ) . to include ( "rack, yard" )
15131513 end
1514+
1515+ it "does not cause double loads when higher versions of default gems are activated before bundler" do
1516+ build_repo2 do
1517+ build_gem "json" , "999.999.999" do |s |
1518+ s . write "lib/json.rb" , <<~RUBY
1519+ module JSON
1520+ VERSION = "999.999.999"
1521+ end
1522+ RUBY
1523+ end
1524+ end
1525+
1526+ system_gems "json-999.999.999" , :gem_repo => gem_repo2
1527+
1528+ install_gemfile "source \" #{ file_uri_for ( gem_repo1 ) } \" "
1529+ ruby <<-RUBY
1530+ require "json"
1531+ require "bundler/setup"
1532+ require "json"
1533+ RUBY
1534+
1535+ expect ( err ) . to be_empty
1536+ end
15141537 end
15151538end
You can’t perform that action at this time.
0 commit comments