diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-04 12:14:06 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-04 17:07:45 +0200 |
commit | 7ca4e5bb4e80a0ed1845b7f609279003898345ce (patch) | |
tree | 45a0ef157eb053f4b93f3e608d2d3be0afa720dd | |
parent | 8805d984636dbcf7d33969744e68a5aba729898e (diff) | |
download | bundler-fix_symlink_spec_on_ruby_2.6.tar.gz |
Fix symlink spec on ruby 2.6fix_symlink_spec_on_ruby_2.6
In rubies where there's no default bundler gem, the original test
requiring that `bundler/setup` doesn't fail to load was correct. But in
rubies where there's a default bundler gem the bug would manifest in a
different way, by loading the incorrect default copy of bundler.
So we instead check that the copy of bundler that we load is the
(expected) symlinked one.
-rw-r--r-- | spec/runtime/setup_spec.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index d1cc970ddf..ac8170d2e1 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -828,20 +828,18 @@ end end end - # Can't make this pass on 2.6 since the ruby standard library has the same $LOAD_PATH - # entry as bundler (since it's a default gem) - it "should successfully require 'bundler/setup'", :ruby_repo, :ruby => "< 2.6" do + it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'", :ruby_repo do install_gemfile "" - ruby <<-'R', :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true - # Remove any bundler that's not the current bundler from $LOAD_PATH - $LOAD_PATH.each do |path| - $LOAD_PATH.delete(path) if File.exist?("#{path}/bundler.rb") + ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true + TracePoint.trace(:class) do |tp| + puts "OMG" if tp.path.include?("bundler") && !tp.path.start_with?("#{File.expand_path("../..", __dir__)}") end - puts (require 'bundler/setup') + gem 'bundler', '#{Bundler::VERSION}' + require 'bundler/setup' R - expect(out).to eql("true") + expect(out).to be_empty end end |