diff options
Diffstat (limited to 'spec/bundler/install/gems')
-rw-r--r-- | spec/bundler/install/gems/compact_index_spec.rb | 14 | ||||
-rw-r--r-- | spec/bundler/install/gems/dependency_api_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/install/gems/mirror_probe_spec.rb | 49 | ||||
-rw-r--r-- | spec/bundler/install/gems/standalone_spec.rb | 4 |
4 files changed, 39 insertions, 44 deletions
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 736c998d79..b7de398c23 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -316,7 +316,7 @@ RSpec.describe "compact index api" do expect(stdboth).not_to include "Double checking" end - it "fetches again when more dependencies are found in subsequent sources", bundler: "< 3" do + it "fetches again when more dependencies are found in subsequent sources", bundler: "2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -375,7 +375,7 @@ RSpec.describe "compact index api" do expect(the_bundle).to include_gems "myrack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do + it "considers all possible versions of dependencies from all api gem sources", bundler: "2" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -471,7 +471,7 @@ RSpec.describe "compact index api" do expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "< 3" do + it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -529,7 +529,7 @@ RSpec.describe "compact index api" do expect(out).to include("Fetching gem metadata from #{source_uri}") end - it "installs the binstubs", bundler: "< 3" do + it "installs the binstubs", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -541,7 +541,7 @@ RSpec.describe "compact index api" do expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", bundler: "< 3" do + it "installs the bins when using --path and uses autoclean", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -552,7 +552,7 @@ RSpec.describe "compact index api" do expect(vendored_gems("bin/myrackup")).to exist end - it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do + it "installs the bins when using --path and uses bundle clean", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -617,7 +617,7 @@ RSpec.describe "compact index api" do expect(the_bundle).to include_gems "myrack 1.0.0" end - it "strips http basic auth creds when warning about ambiguous sources", bundler: "< 3" do + it "strips http basic auth creds when warning about ambiguous sources", bundler: "2" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index 283f1208f2..4ea67b7e31 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -254,7 +254,7 @@ RSpec.describe "gemcutter's dependency API" do end end - it "fetches again when more dependencies are found in subsequent sources", bundler: "< 3" do + it "fetches again when more dependencies are found in subsequent sources", bundler: "2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -313,7 +313,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "myrack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do + it "considers all possible versions of dependencies from all api gem sources", bundler: "2" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -358,7 +358,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to include("Fetching source index from http://localgemserver.test/extra") end - it "does not fetch every spec when doing back deps", bundler: "< 3" do + it "does not fetch every spec when doing back deps", bundler: "2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -397,7 +397,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "back_deps 1.0" end - it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "< 3" do + it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -471,7 +471,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to include("Fetching gem metadata from #{source_uri}") end - it "installs the binstubs", bundler: "< 3" do + it "installs the binstubs", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -483,7 +483,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", bundler: "< 3" do + it "installs the bins when using --path and uses autoclean", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -494,7 +494,7 @@ RSpec.describe "gemcutter's dependency API" do expect(vendored_gems("bin/myrackup")).to exist end - it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do + it "installs the bins when using --path and uses bundle clean", bundler: "2" do gemfile <<-G source "#{source_uri}" gem "myrack" @@ -580,7 +580,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources", bundler: "< 3" do + it "strips http basic auth creds when warning about ambiguous sources", bundler: "2" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" 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..fd8db16966 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 @@ -472,7 +470,7 @@ RSpec.shared_examples "bundle install --standalone" do end end - describe "with --binstubs", bundler: "< 3" do + describe "with --binstubs", bundler: "2" do before do gemfile <<-G source "https://gem.repo1" |