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

Commit

Permalink
Reuse more shared path helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Aug 8, 2019
1 parent f70610d commit 300dcf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
10 changes: 1 addition & 9 deletions spec/bundler/shared_helpers_spec.rb
Expand Up @@ -223,14 +223,6 @@
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" }

Expand All @@ -244,7 +236,7 @@
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#{setup_path}")
expect(ENV["RUBYOPT"].split(" ")).to start_with("-r#{lib}/bundler/setup")
end
end

Expand Down
7 changes: 1 addition & 6 deletions spec/commands/exec_spec.rb
Expand Up @@ -279,12 +279,7 @@
G

rubyopt = ENV["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}"
rubyopt = "-r#{lib}/bundler/setup #{rubyopt}"

bundle "exec 'echo $RUBYOPT'"
expect(out).to have_rubyopts(rubyopt)
Expand Down
8 changes: 3 additions & 5 deletions spec/runtime/setup_spec.rb
Expand Up @@ -801,13 +801,11 @@ def clean_load_path(lp)

FileUtils.ln_s(root, File.join(gems_dir, full_name))

gemspec_file = ruby_core? ? "#{root}/lib/bundler/bundler.gemspec" : "#{root}/bundler.gemspec"
gemspec = File.binread(gemspec_file).
sub("Bundler::VERSION", %("#{Bundler::VERSION}"))
gemspec = gemspec.lines.reject {|line| line =~ %r{lib/bundler/version} }.join
gemspec_content = File.binread(gemspec).sub("Bundler::VERSION", %("#{Bundler::VERSION}"))
gemspec_content = gemspec_content.lines.reject {|line| line =~ %r{lib/bundler/version} }.join

File.open(File.join(specifications_dir, "#{full_name}.gemspec"), "wb") do |f|
f.write(gemspec)
f.write(gemspec_content)
end
end

Expand Down

0 comments on commit 300dcf7

Please sign in to comment.