diff options
Diffstat (limited to 'spec/bundler/install')
-rw-r--r-- | spec/bundler/install/deploy_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/gemspec_spec.rb | 19 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/git_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/groups_spec.rb | 20 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/path_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/sources_spec.rb | 44 | ||||
-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 | ||||
-rw-r--r-- | spec/bundler/install/path_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/install/redownload_spec.rb | 2 |
12 files changed, 97 insertions, 83 deletions
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 7db12c0d0b..6a507ba57b 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "install in deployment or frozen mode" do G end - context "with CLI flags", bundler: "< 3" do + context "with CLI flags", bundler: "2" do it "fails without a lockfile and says that --deployment requires a lock" do bundle "install --deployment", raise_on_error: false expect(err).to include("The --deployment flag requires a lockfile") diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index 4d3eaa37ca..d9469e5ca8 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -260,6 +260,25 @@ RSpec.describe "bundle install from an existing gemspec" do expect(out).to eq("WIN") end + it "does not make Gem.try_activate warn when local gem has extensions" do + build_lib("foo", path: tmp("foo")) do |s| + s.version = "1.0.0" + s.add_c_extension + end + build_repo2 + + install_gemfile <<-G + source "https://gem.repo2" + gemspec :path => '#{tmp("foo")}' + G + + expect(the_bundle).to include_gems "foo 1.0.0" + + run "Gem.try_activate('irb/lc/es/error.rb'); puts 'WIN'" + expect(out).to eq("WIN") + expect(err).to be_empty + end + it "handles downgrades" do build_lib "omg", "2.0", path: lib_path("omg") diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index 36751c46f2..5d6a0a648d 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -26,7 +26,7 @@ RSpec.describe "bundle install with git sources" do expect(out).to eq("WIN") end - it "caches the git repo", bundler: "< 3" do + it "caches the git repo", bundler: "2" do expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes size: 1 end diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb index f6f3edd01c..148b600088 100644 --- a/spec/bundler/install/gemfile/groups_spec.rb +++ b/spec/bundler/install/gemfile/groups_spec.rb @@ -100,7 +100,7 @@ RSpec.describe "bundle install with groups" do expect(out).to include("Set for the current user (#{home(".bundle/config")}): [:emo]") end - it "allows running application where groups where configured by a different user", bundler: "< 3" do + it "allows running application where groups where configured by a different user", bundler: "2" do bundle "config set without emo" bundle :install bundle "exec ruby -e 'puts 42'", env: { "BUNDLE_USER_HOME" => tmp("new_home").to_s } @@ -113,7 +113,7 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).not_to include_gems "activesupport 2.3.5", groups: [:default] end - it "remembers previous exclusion with `--without`", bundler: "< 3" do + it "remembers previous exclusion with `--without`", bundler: "2" do bundle "install --without emo" expect(the_bundle).not_to include_gems "activesupport 2.3.5" bundle :install @@ -159,14 +159,14 @@ RSpec.describe "bundle install with groups" do ENV["BUNDLE_WITHOUT"] = nil end - it "clears --without when passed an empty list", bundler: "< 3" do + it "clears --without when passed an empty list", bundler: "2" do bundle "install --without emo" bundle "install --without ''" expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "doesn't clear without when nothing is passed", bundler: "< 3" do + it "doesn't clear without when nothing is passed", bundler: "2" do bundle "install --without emo" bundle :install @@ -184,7 +184,7 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).to include_gems "thin 1.0" end - it "installs gems from the previously requested group", bundler: "< 3" do + it "installs gems from the previously requested group", bundler: "2" do bundle "install --with debugging" expect(the_bundle).to include_gems "thin 1.0" bundle :install @@ -198,25 +198,25 @@ RSpec.describe "bundle install with groups" do ENV["BUNDLE_WITH"] = nil end - it "clears --with when passed an empty list", bundler: "< 3" do + it "clears --with when passed an empty list", bundler: "2" do bundle "install --with debugging" bundle "install --with ''" expect(the_bundle).not_to include_gems "thin 1.0" end - it "removes groups from without when passed at --with", bundler: "< 3" do + it "removes groups from without when passed at --with", bundler: "2" do bundle "config set --local without emo" bundle "install --with emo" expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "removes groups from with when passed at --without", bundler: "< 3" do + it "removes groups from with when passed at --without", bundler: "2" do bundle "config set --local with debugging" bundle "install --without debugging", raise_on_error: false expect(the_bundle).not_to include_gem "thin 1.0" end - it "errors out when passing a group to with and without via CLI flags", bundler: "< 3" do + it "errors out when passing a group to with and without via CLI flags", bundler: "2" do bundle "install --with emo debugging --without emo", raise_on_error: false expect(last_command).to be_failure expect(err).to include("The offending groups are: emo") @@ -235,7 +235,7 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).to include_gem "thin 1.0" end - it "can add and remove a group at the same time", bundler: "< 3" do + it "can add and remove a group at the same time", bundler: "2" do bundle "install --with debugging --without emo" expect(the_bundle).to include_gems "thin 1.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index 7525404b24..669e63eb9c 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe "bundle install with explicit source paths" do - it "fetches gems with a global path source", bundler: "< 3" do + it "fetches gems with a global path source", bundler: "2" do build_lib "foo" install_gemfile <<-G diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index e1a5245800..e705a835d6 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "refuses to install mismatched checksum because one gem has been tampered with", bundler: "< 3" do + it "refuses to install mismatched checksum because one gem has been tampered with", bundler: "2" do lockfile <<~L GEM remote: https://gem.repo3/ @@ -71,7 +71,7 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config set --local disable_checksum_validation true" end - it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", bundler: "< 3" do + it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", bundler: "2" do bundle :install, artifice: "compact_index" expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") @@ -79,7 +79,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0", source: "remote1") end - it "does not use the full index unnecessarily", bundler: "< 3" do + it "does not use the full index unnecessarily", bundler: "2" do bundle :install, artifice: "compact_index", verbose: true expect(out).to include("https://gem.repo1/versions") @@ -88,7 +88,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(out).not_to include("https://gem.repo3/quick/Marshal.4.8/") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -108,14 +108,14 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "warns about ambiguous gems, but installs anyway", bundler: "< 3" do + it "warns about ambiguous gems, but installs anyway", bundler: "2" do bundle :install, artifice: "compact_index" expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo1") expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0", source: "remote1") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -145,7 +145,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "works in standalone mode", bundler: "< 3" do + it "works in standalone mode", bundler: "2" do gem_checksum = checksum_digest(gem_repo4, "foo", "1.0") bundle "install --standalone", artifice: "compact_index", env: { "BUNDLER_SPEC_FOO_CHECKSUM" => gem_checksum } end @@ -325,7 +325,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "fails when the two sources don't have the same checksum", bundler: "< 3" do + it "fails when the two sources don't have the same checksum", bundler: "2" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to eq(<<~E.strip) @@ -347,7 +347,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(exitstatus).to eq(37) end - it "fails when the two sources agree, but the local gem calculates a different checksum", bundler: "< 3" do + it "fails when the two sources agree, but the local gem calculates a different checksum", bundler: "2" do myrack_checksum = "c0ffee11" * 8 bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => myrack_checksum }, raise_on_error: false @@ -370,7 +370,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(exitstatus).to eq(37) end - it "installs from the other source and warns about ambiguous gems when the sources have the same checksum", bundler: "< 3" do + it "installs from the other source and warns about ambiguous gems when the sources have the same checksum", bundler: "2" do gem_checksum = checksum_digest(gem_repo2, "myrack", "1.0.0") bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => gem_checksum, "DEBUG" => "1" } @@ -410,7 +410,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(previous_lockfile) end - it "installs from the other source and warns about ambiguous gems when checksum validation is disabled", bundler: "< 3" do + it "installs from the other source and warns about ambiguous gems when checksum validation is disabled", bundler: "2" do bundle "config set --local disable_checksum_validation true" bundle :install, artifice: "compact_index" @@ -450,7 +450,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(previous_lockfile) end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -475,7 +475,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the dependency from the pinned source without warning", bundler: "< 3" do + it "installs the dependency from the pinned source without warning", bundler: "2" do bundle :install, artifice: "compact_index" expect(err).not_to include("Warning: the gem 'myrack' was found in multiple sources.") @@ -490,7 +490,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") end - it "fails", bundler: "3" do + it "fails", bundler: "4" do bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) @@ -524,7 +524,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - context "when an indirect dependency can't be found in the aggregate rubygems source", bundler: "< 3" do + context "when an indirect dependency can't be found in the aggregate rubygems source", bundler: "2" do before do build_repo2 @@ -896,7 +896,7 @@ RSpec.describe "bundle install with gems on multiple sources" do L end - it "does not install newer versions or generate lockfile changes when running bundle install in frozen mode, and warns", bundler: "< 3" do + it "does not install newer versions or generate lockfile changes when running bundle install in frozen mode, and warns", bundler: "2" do initial_lockfile = lockfile bundle "config set --local frozen true" @@ -914,7 +914,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(initial_lockfile) end - it "fails when running bundle install in frozen mode", bundler: "3" do + it "fails when running bundle install in frozen mode", bundler: "4" do initial_lockfile = lockfile bundle "config set --local frozen true" @@ -1264,7 +1264,7 @@ RSpec.describe "bundle install with gems on multiple sources" do lockfile aggregate_gem_section_lockfile end - it "installs the existing lockfile but prints a warning when checksum validation is disabled", bundler: "< 3" do + it "installs the existing lockfile but prints a warning when checksum validation is disabled", bundler: "2" do bundle "config set --local deployment true" bundle "config set --local disable_checksum_validation true" @@ -1275,7 +1275,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("myrack 0.9.1", source: "remote3") end - it "prints a checksum warning when the checksums from both sources do not match", bundler: "< 3" do + it "prints a checksum warning when the checksums from both sources do not match", bundler: "2" do bundle "config set --local deployment true" bundle "install", artifice: "compact_index", raise_on_error: false @@ -1302,7 +1302,7 @@ RSpec.describe "bundle install with gems on multiple sources" do E end - it "refuses to install the existing lockfile and prints an error", bundler: "3" do + it "refuses to install the existing lockfile and prints an error", bundler: "4" do bundle "config set --local deployment true" bundle "install", artifice: "compact_index", raise_on_error: false @@ -1583,7 +1583,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(err).to include("Could not reach host gem.repo4. Check your network connection and try again.") end - context "when an indirect dependency is available from multiple ambiguous sources", bundler: "< 3" do + context "when an indirect dependency is available from multiple ambiguous sources", bundler: "2" do it "succeeds but warns, suggesting a source block" do build_repo4 do build_gem "depends_on_myrack" do |s| @@ -1614,7 +1614,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - context "when an indirect dependency is available from multiple ambiguous sources", bundler: "3" do + context "when an indirect dependency is available from multiple ambiguous sources", bundler: "4" do it "raises, suggesting a source block" do build_repo4 do build_gem "depends_on_myrack" do |s| 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" diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb index 1412e8dd24..a51501c348 100644 --- a/spec/bundler/install/path_spec.rb +++ b/spec/bundler/install/path_spec.rb @@ -44,13 +44,13 @@ RSpec.describe "bundle install" do expect(out).to include("gems are installed into `./vendor/bundle`") end - it "disallows --path vendor/bundle --system", bundler: "< 3" do + it "disallows --path vendor/bundle --system", bundler: "2" do bundle "install --path vendor/bundle --system", raise_on_error: false expect(err).to include("Please choose only one option.") expect(exitstatus).to eq(15) end - it "remembers to disable system gems after the first time with bundle --path vendor/bundle", bundler: "< 3" do + it "remembers to disable system gems after the first time with bundle --path vendor/bundle", bundler: "2" do bundle "install --path vendor/bundle" FileUtils.rm_r bundled_app("vendor") bundle "install" @@ -62,7 +62,7 @@ RSpec.describe "bundle install" do context "with path_relative_to_cwd set to true" do before { bundle "config set path_relative_to_cwd true" } - it "installs the bundle relatively to current working directory", bundler: "< 3" do + it "installs the bundle relatively to current working directory", bundler: "2" do bundle "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", dir: bundled_app.parent expect(out).to include("installed into `./vendor/bundle`") expect(bundled_app("../vendor/bundle")).to be_directory diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb index b522e22bd5..84f983375d 100644 --- a/spec/bundler/install/redownload_spec.rb +++ b/spec/bundler/install/redownload_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "bundle install" do end end - describe "with --force", bundler: 2 do + describe "with --force", bundler: "2" do it_behaves_like "an option to force redownloading gems" do let(:flag) { "force" } end |