Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Add half-assed spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ojab committed Apr 27, 2018
1 parent 4525330 commit b64853a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/shared_helpers.rb
Expand Up @@ -337,7 +337,7 @@ def clean_load_path

$LOAD_PATH.reject! do |p|
path = File.expand_path(p)
path = File.realpath(path) if File.exist?(path)
# path = File.realpath(path) if File.exist?(path)
next if path.start_with?(bundler_lib)
loaded_gem_paths.delete(p)
end
Expand Down
36 changes: 36 additions & 0 deletions spec/runtime/setup_spec.rb
Expand Up @@ -861,6 +861,42 @@ def clean_load_path(lp)
expect(out).to eq("true\ntrue")
end

context "with bundler is located in symlinked GEM_HOME" do
let(:gem_home) { Dir.mktmpdir }
let(:symlinked_gem_home) { Tempfile.new }
let(:bundler_dir) { File.expand_path("../..", __dir__) }

before do
FileUtils.ln_sf(gem_home, symlinked_gem_home)
gems_dir = File.join(gem_home, "gems")
specifications_dir = File.join(gem_home, "specifications")
Dir.mkdir(gems_dir)
Dir.mkdir(specifications_dir)

FileUtils.ln_s(bundler_dir, File.join(gems_dir, "bundler-#{Bundler::VERSION}"))

gemspec = File.read("#{bundler_dir}/bundler.gemspec").
sub("Bundler::VERSION", %("#{Bundler::VERSION}"))
gemspec = gemspec.lines.grep_v(%r{lib/bundler/version}).join

File.open(File.join(specifications_dir, "bundler.gemspec"), "wb") do |f|
f.write(gemspec)
end
end

it "should succesfully require 'bundler/setup'" do
install_gemfile ""

ENV["GEM_PATH"] = symlinked_gem_home.to_path
ruby <<-R
$LOAD_PATH.delete_at(0)
puts (require 'bundler/setup')
R

expect(out).to eql("true")
end
end

it "stubs out Gem.refresh so it does not reveal system gems" do
system_gems "rack-1.0.0"

Expand Down

0 comments on commit b64853a

Please sign in to comment.