summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-08 10:41:56 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-16 08:43:46 +0200
commit79fdebd86849fd70c1d2dd6e7ad9d5e1659543e5 (patch)
tree08242f3c3a213c2d0cdcec39a40844f4941a4e0d
parente483322519fef4c1dcbab9a91f6e64379cce4fa7 (diff)
downloadbundler-79fdebd86849fd70c1d2dd6e7ad9d5e1659543e5.tar.gz
Reuse more shared path helpers
-rw-r--r--spec/bundler/shared_helpers_spec.rb10
-rw-r--r--spec/commands/exec_spec.rb7
-rw-r--r--spec/runtime/setup_spec.rb5
3 files changed, 4 insertions, 18 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 910854fe46..c5ec939978 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -223,14 +223,6 @@ RSpec.describe Bundler::SharedHelpers do
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" }
@@ -244,7 +236,7 @@ RSpec.describe Bundler::SharedHelpers do
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
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 7faaad1c81..c68a9c4f43 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -279,12 +279,7 @@ RSpec.describe "bundle exec" do
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)
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 9e92c513b8..46dda097ab 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -815,13 +815,12 @@ end
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).
+ gemspec_content = File.binread(gemspec).
sub("Bundler::VERSION", %("#{Bundler::VERSION}")).
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