summaryrefslogtreecommitdiff
path: root/spec/bundler/runtime
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-05-28 12:47:49 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-07-07 13:30:20 +0900
commit6e2240a2f954c84ed12357382c9c065ae4b91e11 (patch)
treeef4b33a9a67843cbc45aad510d7bca9f2a763496 /spec/bundler/runtime
parent9952e9358ea73a1bda8d5f8c8672ee1c04892ce4 (diff)
Sync latest bundler & rubygems development version
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4533
Diffstat (limited to 'spec/bundler/runtime')
-rw-r--r--spec/bundler/runtime/inline_spec.rb10
-rw-r--r--spec/bundler/runtime/load_spec.rb2
-rw-r--r--spec/bundler/runtime/platform_spec.rb2
-rw-r--r--spec/bundler/runtime/require_spec.rb2
-rw-r--r--spec/bundler/runtime/setup_spec.rb37
5 files changed, 17 insertions, 36 deletions
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 57b7392608..cfcf556658 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundler/inline#gemfile" do
def script(code, options = {})
- requires = ["#{lib_dir}/bundler/inline"]
+ requires = ["#{entrypoint}/inline"]
requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice)
requires = requires.map {|r| "require '#{r}'" }.join("\n")
ruby("#{requires}\n\n" + code, options)
@@ -93,7 +93,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "lets me use my own ui object" do
script <<-RUBY, :artifice => "endpoint"
- require '#{lib_dir}/bundler'
+ require '#{entrypoint}'
class MyBundlerUI < Bundler::UI::Silent
def confirm(msg, newline = nil)
puts "CONFIRMED!"
@@ -110,7 +110,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "has an option for quiet installation" do
script <<-RUBY, :artifice => "endpoint"
- require '#{lib_dir}/bundler/inline'
+ require '#{entrypoint}/inline'
gemfile(true, :quiet => true) do
source "https://notaserver.com"
@@ -136,7 +136,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "does not mutate the option argument" do
script <<-RUBY
- require '#{lib_dir}/bundler'
+ require '#{entrypoint}'
options = { :ui => Bundler::UI::Shell.new }
gemfile(false, options) do
path "#{lib_path}" do
@@ -218,7 +218,7 @@ RSpec.describe "bundler/inline#gemfile" do
rake
BUNDLED WITH
- 1.13.6
+ #{Bundler::VERSION}
G
script <<-RUBY
diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb
index 0274ba18b8..96a22a46cc 100644
--- a/spec/bundler/runtime/load_spec.rb
+++ b/spec/bundler/runtime/load_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe "Bundler.load" do
G
ruby <<-RUBY
- require "#{lib_dir}/bundler"
+ require "#{entrypoint}"
Bundler.setup :default
Bundler.require :default
puts RACK
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index bec42e0f70..d81bccbdf8 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
ruby <<-R
begin
- require '#{lib_dir}/bundler'
+ require '#{entrypoint}'
Bundler.ui.silence { Bundler.setup }
rescue Bundler::GemNotFound => e
puts "WIN"
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index ad30529e86..a3fa4fbe47 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -192,7 +192,7 @@ RSpec.describe "Bundler.require" do
G
cmd = <<-RUBY
- require '#{lib_dir}/bundler'
+ require '#{entrypoint}'
Bundler.require
RUBY
ruby(cmd)
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 4d5e1c616e..d8ba569f0a 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -108,8 +108,8 @@ RSpec.describe "Bundler.setup" do
context "load order" do
def clean_load_path(lp)
without_bundler_load_path = ruby("puts $LOAD_PATH").split("\n")
- lp -= without_bundler_load_path
- lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib_dir.to_s}/i, "") }
+ lp -= [*without_bundler_load_path, lib_dir.to_s]
+ lp.map! {|p| p.sub(system_gem_path.to_s, "") }
end
it "puts loaded gems after -I and RUBYLIB", :ruby_repo do
@@ -143,12 +143,8 @@ RSpec.describe "Bundler.setup" do
gem "rails"
G
- # We require an absolute path because relying on the $LOAD_PATH behaves
- # inconsistently depending on whether we're in a ruby-core setup (and
- # bundler's lib is in RUBYLIB) or not.
-
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
puts $LOAD_PATH
RUBY
@@ -157,7 +153,6 @@ RSpec.describe "Bundler.setup" do
expect(load_path).to start_with(
"/gems/rails-2.3.2/lib",
- "/gems/bundler-#{Bundler::VERSION}/lib",
"/gems/activeresource-2.3.2/lib",
"/gems/activerecord-2.3.2/lib",
"/gems/actionpack-2.3.2/lib",
@@ -168,6 +163,8 @@ RSpec.describe "Bundler.setup" do
end
it "falls back to order the load path alphabetically for backwards compatibility" do
+ bundle "config set path.system true"
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "weakling"
@@ -175,12 +172,8 @@ RSpec.describe "Bundler.setup" do
gem "terranova"
G
- # We require an absolute path because relying on the $LOAD_PATH behaves
- # inconsistently depending on whether we're in a ruby-core setup (and
- # bundler's lib is in RUBYLIB) or not.
-
ruby <<-RUBY
- require '#{lib_dir}/bundler/setup'
+ require 'bundler/setup'
puts $LOAD_PATH
RUBY
@@ -200,8 +193,6 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
- entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
-
ruby <<-R
require '#{entrypoint}'
@@ -474,8 +465,6 @@ RSpec.describe "Bundler.setup" do
break_git!
- entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
-
ruby <<-R
require "#{entrypoint}"
@@ -1126,9 +1115,8 @@ end
context "is not present" do
it "does not change the lock" do
- entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
lockfile lock_with(nil)
- ruby "require '#{entrypoint}'"
+ ruby "require '#{entrypoint}/setup'"
lockfile_should_be lock_with(nil)
end
end
@@ -1145,10 +1133,9 @@ end
context "is older" do
it "does not change the lock" do
- entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
system_gems "bundler-1.10.1"
lockfile lock_with("1.10.1")
- ruby "require '#{entrypoint}'"
+ ruby "require '#{entrypoint}/setup'"
lockfile_should_be lock_with("1.10.1")
end
end
@@ -1219,9 +1206,8 @@ end
describe "with gemified standard libraries" do
it "does not load Psych" do
gemfile ""
- entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
ruby <<-RUBY
- require '#{entrypoint}'
+ require '#{entrypoint}/setup'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
require 'psych'
puts Psych::VERSION
@@ -1422,9 +1408,4 @@ end
expect(last_command.stdboth).to eq("true")
end
end
-
- # Tested rubygems does not include https://github.com/rubygems/rubygems/pull/2728 and will not always end up activating the current bundler
- def mis_activates_prerelease_default_bundler?
- Gem.rubygems_version < Gem::Version.new("3.1.a")
- end
end