summaryrefslogtreecommitdiff
path: root/spec/bundler/install/gems
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/install/gems')
-rw-r--r--spec/bundler/install/gems/mirror_probe_spec.rb49
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb2
2 files changed, 23 insertions, 28 deletions
diff --git a/spec/bundler/install/gems/mirror_probe_spec.rb b/spec/bundler/install/gems/mirror_probe_spec.rb
index 5edd829e7b..fe9654e0a9 100644
--- a/spec/bundler/install/gems/mirror_probe_spec.rb
+++ b/spec/bundler/install/gems/mirror_probe_spec.rb
@@ -1,9 +1,6 @@
# frozen_string_literal: true
RSpec.describe "fetching dependencies with a not available mirror" do
- let(:mirror) { @mirror_uri }
- let(:original) { @server_uri }
- let(:server_port) { @server_port }
let(:host) { "127.0.0.1" }
before do
@@ -20,13 +17,13 @@ RSpec.describe "fetching dependencies with a not available mirror" do
context "with a specific fallback timeout" do
before do
- global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/__FALLBACK_TIMEOUT/" => "true",
- "BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror)
+ global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/__FALLBACK_TIMEOUT/" => "true",
+ "BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri)
end
it "install a gem using the original uri when the mirror is not responding" do
gemfile <<-G
- source "#{original}"
+ source "#{@server_uri}"
gem 'weakling'
G
@@ -41,12 +38,12 @@ RSpec.describe "fetching dependencies with a not available mirror" do
context "with a global fallback timeout" do
before do
global_config("BUNDLE_MIRROR__ALL__FALLBACK_TIMEOUT/" => "1",
- "BUNDLE_MIRROR__ALL" => mirror)
+ "BUNDLE_MIRROR__ALL" => @mirror_uri)
end
it "install a gem using the original uri when the mirror is not responding" do
gemfile <<-G
- source "#{original}"
+ source "#{@server_uri}"
gem 'weakling'
G
@@ -60,47 +57,47 @@ RSpec.describe "fetching dependencies with a not available mirror" do
context "with a specific mirror without a fallback timeout" do
before do
- global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{server_port}/" => mirror)
+ global_config("BUNDLE_MIRROR__HTTP://127__0__0__1:#{@server_port}/" => @mirror_uri)
end
- it "fails to install the gem with a timeout error" do
+ it "fails to install the gem with a timeout error when the mirror is not responding" do
gemfile <<-G
- source "#{original}"
+ source "#{@server_uri}"
gem 'weakling'
G
bundle :install, artifice: nil, raise_on_error: false
- expect(out).to include("Fetching source index from #{mirror}")
+ expect(out).to include("Fetching source index from #{@mirror_uri}")
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 <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ 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_uri}/ 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_uri}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <})
end
end
context "with a global mirror without a fallback timeout" do
before do
- global_config("BUNDLE_MIRROR__ALL" => mirror)
+ global_config("BUNDLE_MIRROR__ALL" => @mirror_uri)
end
- it "fails to install the gem with a timeout error" do
+ it "fails to install the gem with a timeout error when the mirror is not responding" do
gemfile <<-G
- source "#{original}"
+ source "#{@server_uri}"
gem 'weakling'
G
bundle :install, artifice: nil, raise_on_error: false
- expect(out).to include("Fetching source index from #{mirror}")
+ expect(out).to include("Fetching source index from #{@mirror_uri}")
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 <})
+ expect(err_lines).to include(%r{\ARetrying fetcher due to error \(2/4\): Bundler::HTTPError Could not fetch specs from #{@mirror_uri}/ 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_uri}/ 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_uri}/ due to underlying error <})
+ expect(err_lines).to include(%r{\ACould not fetch specs from #{@mirror_uri}/ due to underlying error <})
end
end
@@ -108,13 +105,13 @@ RSpec.describe "fetching dependencies with a not available mirror" do
@server_port = find_unused_port
@server_uri = "http://#{host}:#{@server_port}"
- require_relative "../../support/artifice/endpoint"
+ require_relative "../../support/artifice/compact_index"
require_relative "../../support/silent_logger"
require "rackup/server"
@server_thread = Thread.new do
- Rackup::Server.start(app: Endpoint,
+ Rackup::Server.start(app: CompactIndexAPI,
Host: host,
Port: @server_port,
server: "webrick",
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index 50ef4dc3a7..7ad657a738 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -147,7 +147,6 @@ RSpec.shared_examples "bundle install --standalone" do
it "works and points to the vendored copies, not to the default copies" do
necessary_gems_in_bundle_path = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.4.3", "stringio --version 3.1.0"]
- necessary_gems_in_bundle_path += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a")
realworld_system_gems(*necessary_gems_in_bundle_path, path: scoped_gem_path(bundled_app("bundle")))
build_gem "foo", "1.0.0", to_system: true, default: true do |s|
@@ -186,7 +185,6 @@ RSpec.shared_examples "bundle install --standalone" do
it "works for gems with extensions and points to the vendored copies, not to the default copies" do
simulate_platform "arm64-darwin-23" do
necessary_gems_in_bundle_path = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.4.3", "stringio --version 3.1.0", "shellwords --version 0.2.0", "open3 --version 0.2.1"]
- necessary_gems_in_bundle_path += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a")
realworld_system_gems(*necessary_gems_in_bundle_path, path: scoped_gem_path(bundled_app("bundle")))
build_gem "baz", "1.0.0", to_system: true, default: true, &:add_c_extension