summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-12-23 09:21:36 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-12-23 09:44:45 +0900
commitfb1ab27f535833f1ba1648d7cdce4cc893e36d07 (patch)
treefab2ac1a60ba75a8e897d6077c8234af2fd77900 /spec/bundler
parentfeaf4fbc3fa16382fbd07158c448c7b5bdae78b5 (diff)
Merge RubyGems-3.3.1 and Bundler-2.3.1
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5325
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb2
-rw-r--r--spec/bundler/realworld/mirror_probe_spec.rb33
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb6
-rw-r--r--spec/bundler/support/artifice/compact_index.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_500.rb2
-rw-r--r--spec/bundler/support/artifice/windows.rb2
-rw-r--r--spec/bundler/support/builders.rb2
-rw-r--r--spec/bundler/support/helpers.rb2
-rw-r--r--spec/bundler/support/path.rb4
-rw-r--r--spec/bundler/support/rubygems_ext.rb9
11 files changed, 30 insertions, 36 deletions
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index faefda25f4..337d5f021c 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -116,7 +116,7 @@ RSpec.shared_examples "bundle install --standalone" do
realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0"
necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "yaml --version 0.1.1", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.0"]
- necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.3.a")
+ necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.a")
realworld_system_gems(*necessary_system_gems, :path => scoped_gem_path(bundled_app("bundle")))
build_gem "foo", "1.0.0", :to_system => true, :default => true do |s|
diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb
index b5aaf676e9..241424d4d6 100644
--- a/spec/bundler/realworld/mirror_probe_spec.rb
+++ b/spec/bundler/realworld/mirror_probe_spec.rb
@@ -74,25 +74,12 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- end
- it "prints each error and warning on a new line" do
- gemfile <<-G
- source "#{original}"
- gem 'weakling'
- G
-
- bundle :install, :artifice => nil, :raise_on_error => false
-
- expect(out).to include "Fetching source index from #{mirror}/"
- expect(err).to include "Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)"
- expect(err).to include "Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)"
- expect(err).to include "Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)"
- expect(err).to include "Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)"
+ err_lines = err.split("\n")
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <})
end
end
@@ -110,10 +97,12 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
- expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2)")
+
+ err_lines = err.split("\n")
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(3/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(4/4\): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ACould not fetch specs from #{mirror}/ due to underlying error <})
end
end
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
index b0ef0cc144..b89fdf2cb1 100644
--- a/spec/bundler/runtime/gem_tasks_spec.rb
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
it "includes the relevant tasks" do
- with_gem_path_as(base_system_gems.to_s) do
+ with_gem_path_as(base_system_gem_path.to_s) do
sys_exec "#{rake} -T", :env => { "GEM_HOME" => system_gem_path.to_s }
end
@@ -44,7 +44,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
it "defines a working `rake install` task", :ruby_repo do
- with_gem_path_as(base_system_gems.to_s) do
+ with_gem_path_as(base_system_gem_path.to_s) do
sys_exec "#{rake} install", :env => { "GEM_HOME" => system_gem_path.to_s }
end
@@ -98,7 +98,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
it "adds 'pkg' to rake/clean's CLOBBER" do
- with_gem_path_as(base_system_gems.to_s) do
+ with_gem_path_as(base_system_gem_path.to_s) do
sys_exec %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect'), :env => { "GEM_HOME" => system_gem_path.to_s }
end
expect(out).to eq '["pkg"]'
diff --git a/spec/bundler/support/artifice/compact_index.rb b/spec/bundler/support/artifice/compact_index.rb
index 1b314e89ef..fb068fa9b5 100644
--- a/spec/bundler/support/artifice/compact_index.rb
+++ b/spec/bundler/support/artifice/compact_index.rb
@@ -2,7 +2,7 @@
require_relative "endpoint"
-$LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/compact_index*/lib")].first.to_s
+$LOAD_PATH.unshift Dir[Spec::Path.base_system_gem_path.join("gems/compact_index*/lib")].first.to_s
require "compact_index"
class CompactIndexAPI < Endpoint
diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb
index 4a820e5a3f..c00113b28f 100644
--- a/spec/bundler/support/artifice/endpoint.rb
+++ b/spec/bundler/support/artifice/endpoint.rb
@@ -2,7 +2,7 @@
require_relative "../path"
-$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
+$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gem_path.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
require "artifice"
require "sinatra/base"
diff --git a/spec/bundler/support/artifice/endpoint_500.rb b/spec/bundler/support/artifice/endpoint_500.rb
index 0ce8dfeaad..a0d850a44d 100644
--- a/spec/bundler/support/artifice/endpoint_500.rb
+++ b/spec/bundler/support/artifice/endpoint_500.rb
@@ -2,7 +2,7 @@
require_relative "../path"
-$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
+$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gem_path.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
require "artifice"
require "sinatra/base"
diff --git a/spec/bundler/support/artifice/windows.rb b/spec/bundler/support/artifice/windows.rb
index ddbbd62b96..674470688d 100644
--- a/spec/bundler/support/artifice/windows.rb
+++ b/spec/bundler/support/artifice/windows.rb
@@ -2,7 +2,7 @@
require_relative "../path"
-$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
+$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gem_path.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
require "artifice"
require "sinatra/base"
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 90e9cbb242..aca31638ac 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -259,7 +259,7 @@ module Spec
@_build_path = "#{path}/gems"
@_build_repo = File.basename(path)
yield
- with_gem_path_as Path.base_system_gems do
+ with_gem_path_as Path.base_system_gem_path do
gem_command :generate_index, :dir => path
end
ensure
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 5238c8b980..99baec24d4 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -545,7 +545,7 @@ module Spec
def require_rack
# need to hack, so we can require rack
old_gem_home = ENV["GEM_HOME"]
- ENV["GEM_HOME"] = Spec::Path.base_system_gems.to_s
+ ENV["GEM_HOME"] = Spec::Path.base_system_gem_path.to_s
require "rack"
ENV["GEM_HOME"] = old_gem_home
end
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index a73b3e699e..3304c69c78 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -146,6 +146,10 @@ module Spec
bundled_app("Gemfile.lock")
end
+ def base_system_gem_path
+ scoped_gem_path(base_system_gems)
+ end
+
def base_system_gems
tmp.join("gems/base")
end
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index 9389543a0f..62ba4d56c4 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -59,15 +59,13 @@ module Spec
Gem.clear_paths
ENV["BUNDLE_PATH"] = nil
- ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
+ ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gem_path.to_s
ENV["PATH"] = [Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
ENV["PATH"] = [Path.bindir, ENV["PATH"]].join(File::PATH_SEPARATOR) if Path.ruby_core?
end
def install_test_deps
- setup_test_paths
-
- install_gems(test_gemfile)
+ install_gems(test_gemfile, Path.base_system_gems.to_s)
install_gems(rubocop_gemfile, Path.rubocop_gems.to_s)
install_gems(standard_gemfile, Path.standard_gems.to_s)
end
@@ -109,7 +107,9 @@ module Spec
def install_gems(gemfile, path = nil)
old_gemfile = ENV["BUNDLE_GEMFILE"]
+ old_orig_gemfile = ENV["BUNDLER_ORIG_BUNDLE_GEMFILE"]
ENV["BUNDLE_GEMFILE"] = gemfile.to_s
+ ENV["BUNDLER_ORIG_BUNDLE_GEMFILE"] = nil
if path
old_path = ENV["BUNDLE_PATH"]
@@ -128,6 +128,7 @@ module Spec
ENV["BUNDLE_PATH__SYSTEM"] = old_path__system
end
+ ENV["BUNDLER_ORIG_BUNDLE_GEMFILE"] = old_orig_gemfile
ENV["BUNDLE_GEMFILE"] = old_gemfile
end