diff options
Diffstat (limited to 'spec/bundler')
43 files changed, 245 insertions, 227 deletions
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index bfafe83589..63803600aa 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -87,7 +87,7 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message", bundler: "3" do + it "prints a concise help message", bundler: "4" do bundle "" expect(err).to be_empty expect(out).to include("Bundler version #{Bundler::VERSION}"). @@ -250,12 +250,12 @@ To update to the most recent version, run `bundle update --bundler` end RSpec.describe "bundler executable" do - it "shows the bundler version just as the `bundle` executable does", bundler: "< 3" do + it "shows the bundler version just as the `bundle` executable does", bundler: "2" do bundler "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "shows the bundler version just as the `bundle` executable does", bundler: "3" do + it "shows the bundler version just as the `bundle` executable does", bundler: "4" do bundler "--version" expect(out).to eq(Bundler::VERSION) end diff --git a/spec/bundler/bundler/current_ruby_spec.rb b/spec/bundler/bundler/current_ruby_spec.rb index 61206d258b..9d6cb518cd 100644 --- a/spec/bundler/bundler/current_ruby_spec.rb +++ b/spec/bundler/bundler/current_ruby_spec.rb @@ -139,18 +139,18 @@ RSpec.describe Bundler::CurrentRuby do end describe "Deprecated platform" do - it "Outputs a deprecation warning when calling maglev?", bundler: "< 3" do + it "Outputs a deprecation warning when calling maglev?", bundler: "2" do expect(Bundler.ui).to receive(:warn).with(/`CurrentRuby#maglev\?` is deprecated with no replacement./) Bundler.current_ruby.maglev? end - it "Outputs a deprecation warning when calling maglev_31?", bundler: "< 3" do + it "Outputs a deprecation warning when calling maglev_31?", bundler: "2" do expect(Bundler.ui).to receive(:warn).with(/`CurrentRuby#maglev_31\?` is deprecated with no replacement./) Bundler.current_ruby.maglev_31? end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end end diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb index 9dca4ade05..1fb46e6ba9 100644 --- a/spec/bundler/bundler/dsl_spec.rb +++ b/spec/bundler/bundler/dsl_spec.rb @@ -103,7 +103,7 @@ RSpec.describe Bundler::Dsl do ) end - context "default hosts", bundler: "< 3" do + context "default hosts", bundler: "2" do it "converts :github to URI using https" do subject.gem("sparks", github: "indirect/sparks") github_uri = "https://github.com/indirect/sparks.git" diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb index 966cb6f531..0d77ee85e6 100644 --- a/spec/bundler/cache/path_spec.rb +++ b/spec/bundler/cache/path_spec.rb @@ -97,7 +97,7 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "does not cache path gems by default", bundler: "< 3" do + it "does not cache path gems by default", bundler: "2" do build_lib "foo" install_gemfile <<-G @@ -110,7 +110,7 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "caches path gems by default", bundler: "3" do + it "caches path gems by default", bundler: "4" do build_lib "foo" install_gemfile <<-G diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index c66b9339ee..44456f8dbf 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -168,7 +168,7 @@ RSpec.describe "bundle binstubs <gem>" do expect(bundled_app("exec/myrackup")).to exist end - it "setting is saved for bundle install", bundler: "< 3" do + it "setting is saved for bundle install", bundler: "2" do install_gemfile <<-G source "https://gem.repo1" gem "myrack" diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index 3f7a627296..50289ca65a 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -158,7 +158,7 @@ RSpec.describe "bundle cache" do end end - context "with --path", bundler: "< 3" do + context "with --path", bundler: "2" do it "sets root directory for gems" do gemfile <<-D source "https://gem.repo1" @@ -221,7 +221,7 @@ RSpec.describe "bundle cache" do expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end - it "puts the gems in vendor/cache even for legacy windows rubies, but prints a warning", bundler: "< 3" do + it "puts the gems in vendor/cache even for legacy windows rubies, but prints a warning", bundler: "2" do gemfile <<-D source "https://gem.repo1" gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20] @@ -232,7 +232,7 @@ RSpec.describe "bundle cache" do expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end - it "prints an error when using legacy windows rubies", bundler: "3" do + it "prints an error when using legacy windows rubies", bundler: "4" do gemfile <<-D source "https://gem.repo1" gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20] diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index 150ee62878..8a68a44f0d 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -123,7 +123,7 @@ RSpec.describe "bundle check" do expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end - it "remembers --without option from install", bundler: "< 3" do + it "remembers --without option from install", bundler: "2" do gemfile <<-G source "https://gem.repo1" group :foo do @@ -272,7 +272,7 @@ RSpec.describe "bundle check" do expect(last_command).to be_failure end - context "--path", bundler: "< 3" do + context "--path", bundler: "2" do context "after installing gems in the proper directory" do before do gemfile <<-G diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 2559be0205..176a125a48 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -383,7 +383,7 @@ RSpec.describe "bundle clean" do expect(out).to include("myrack (1.0.0)").and include("thin (1.0)") end - it "--clean should override the bundle setting on install", bundler: "< 3" do + it "--clean should override the bundle setting on install", bundler: "2" do gemfile <<-G source "https://gem.repo1" @@ -405,7 +405,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "thin-1.0" end - it "--clean should override the bundle setting on update", bundler: "< 3" do + it "--clean should override the bundle setting on update", bundler: "2" do build_repo2 gemfile <<-G @@ -427,7 +427,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", bundler: "3" do + it "automatically cleans when path has not been set", bundler: "4" do build_repo2 install_gemfile <<-G diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index aa504ea2a7..a09f714bb6 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -699,6 +699,27 @@ RSpec.describe "bundle exec" do end end + describe "running gem commands in presence of rubygems plugins" do + before do + build_repo4 do + build_gem "foo" do |s| + s.write "lib/rubygems_plugin.rb", "puts 'FAIL'" + end + end + + system_gems "foo-1.0", path: default_bundle_path, gem_repo: gem_repo4 + + install_gemfile <<-G + source "https://gem.repo4" + G + end + + it "does not load plugins outside of the bundle" do + bundle "exec #{gem_cmd} -v" + expect(out).not_to include("FAIL") + end + end + context "`load`ing a ruby file instead of `exec`ing" do let(:path) { bundled_app("ruby_executable") } let(:shebang) { "#!/usr/bin/env ruby" } diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index 4998b6e89d..2630b8993b 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle inject", bundler: "< 3" do +RSpec.describe "bundle inject", bundler: "2" do before :each do gemfile <<-G source "https://gem.repo1" @@ -79,7 +79,7 @@ Usage: "bundle inject GEM VERSION" context "when frozen" do before do bundle "install" - if Bundler.feature_flag.bundler_3_mode? + if Bundler.feature_flag.bundler_4_mode? bundle "config set --local deployment true" else bundle "config set --local frozen true" diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 98883b1e72..df30a63c36 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app_lock).to exist end - it "does not create ./.bundle by default", bundler: "< 3" do + it "does not create ./.bundle by default", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "myrack" @@ -334,14 +334,14 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "myrack 1.0" end - it "allows running bundle install --system without deleting foo", bundler: "< 3" do + it "allows running bundle install --system without deleting foo", bundler: "2" do bundle "install --path vendor" bundle "install --system" FileUtils.rm_r(bundled_app("vendor")) expect(the_bundle).to include_gems "myrack 1.0" end - it "allows running bundle install --system after deleting foo", bundler: "< 3" do + it "allows running bundle install --system after deleting foo", bundler: "2" do bundle "install --path vendor" FileUtils.rm_r(bundled_app("vendor")) bundle "install --system" @@ -349,7 +349,7 @@ RSpec.describe "bundle install with gem sources" do end end - it "finds gems in multiple sources", bundler: "< 3" do + it "finds gems in multiple sources", bundler: "2" do build_repo2 do build_gem "myrack", "1.2" do |s| s.executables = "myrackup" diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index dd2aa5c8c4..608f05418f 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -162,7 +162,7 @@ RSpec.describe "bundle gem" do end shared_examples_for "--rubocop flag" do - context "is deprecated", bundler: "< 3" do + context "is deprecated", bundler: "2" do before do global_config "BUNDLE_GEM__LINTER" => nil bundle "gem #{gem_name} --rubocop" @@ -198,7 +198,7 @@ RSpec.describe "bundle gem" do end shared_examples_for "--no-rubocop flag" do - context "is deprecated", bundler: "< 3" do + context "is deprecated", bundler: "2" do define_negated_matcher :exclude, :include before do @@ -386,7 +386,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --linter=rubocop" bundle_exec_rubocop @@ -395,7 +394,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=minitest, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=minitest --linter=rubocop" bundle_exec_rubocop @@ -404,7 +402,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=rspec, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=rspec --linter=rubocop" bundle_exec_rubocop @@ -413,7 +410,6 @@ RSpec.describe "bundle gem" do it "has no rubocop offenses when using --ext=rust, --test=test-unit, and --linter=rubocop flag" do skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core? - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version bundle "gem #{gem_name} --ext=rust --test=test-unit --linter=rubocop" bundle_exec_rubocop @@ -1378,7 +1374,7 @@ RSpec.describe "bundle gem" do end end - context "gem.rubocop setting set to true", bundler: "< 3" do + context "gem.rubocop setting set to true", bundler: "2" do before do global_config "BUNDLE_GEM__LINTER" => nil bundle "config set gem.rubocop true" @@ -1661,7 +1657,7 @@ RSpec.describe "bundle gem" do include_examples "generating a gem" context "--ext parameter with no value" do - context "is deprecated", bundler: "< 3" do + context "is deprecated", bundler: "2" do it "prints deprecation when used after gem name" do bundle ["gem", "--ext", gem_name].compact.join(" ") expect(err).to include "[DEPRECATED]" @@ -1724,24 +1720,10 @@ RSpec.describe "bundle gem" do end end - context "--ext parameter set with rust and old RubyGems" do - it "fails in friendly way" do - if ::Gem::Version.new("3.3.11") <= ::Gem.rubygems_version - skip "RubyGems compatible with Rust builder" - end - - expect do - bundle ["gem", gem_name, "--ext=rust"].compact.join(" ") - end.to raise_error(RuntimeError, /too old to build Rust extension/) - end - end - context "--ext parameter set with rust" do let(:flags) { "--ext=rust" } before do - skip "RubyGems incompatible with Rust builder" if ::Gem::Version.new("3.3.11") > ::Gem.rubygems_version - bundle ["gem", gem_name, flags].compact.join(" ") end diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index 09b0e6f32f..5c7b574f6d 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -151,7 +151,7 @@ RSpec.describe "bundle outdated" do end end - describe "with multiple, duplicated sources, with lockfile in old format", bundler: "< 3" do + describe "with multiple, duplicated sources, with lockfile in old format", bundler: "2" do before do build_repo2 do build_gem "dotenv", "2.7.6" @@ -819,7 +819,7 @@ RSpec.describe "bundle outdated" do expect(out).to include("Installing foo 1.0") end - context "after bundle install --deployment", bundler: "< 3" do + context "after bundle install --deployment", bundler: "2" do before do build_repo2 diff --git a/spec/bundler/commands/platform_spec.rb b/spec/bundler/commands/platform_spec.rb index 17183e7546..293b7ffa95 100644 --- a/spec/bundler/commands/platform_spec.rb +++ b/spec/bundler/commands/platform_spec.rb @@ -646,7 +646,7 @@ G expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "fails if ruby version doesn't match", bundler: "< 3" do + it "fails if ruby version doesn't match", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "rails" @@ -658,7 +658,7 @@ G should_be_ruby_version_incorrect end - it "fails if engine doesn't match", bundler: "< 3" do + it "fails if engine doesn't match", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "rails" @@ -670,7 +670,7 @@ G should_be_engine_incorrect end - it "fails if engine version doesn't match", bundler: "< 3", jruby_only: true do + it "fails if engine version doesn't match", bundler: "2", jruby_only: true do gemfile <<-G source "https://gem.repo1" gem "rails" @@ -682,7 +682,7 @@ G should_be_engine_version_incorrect end - it "fails when patchlevel doesn't match", bundler: "< 3" do + it "fails when patchlevel doesn't match", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "myrack" diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 7b5ac1aec9..0920b43f9b 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -142,7 +142,7 @@ Could not find gem 'not-a-gem' in rubygems repository https://gem.repo1/ or inst end end - describe "for second bundle install run", bundler: "< 3" do + describe "for second bundle install run", bundler: "2" do it "without any options" do 2.times { bundle :install } expect(out).to include(bundle_show_message) diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 84505169ca..e137e74503 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -43,7 +43,7 @@ RSpec.describe "bundle remove" do end end - context "when --install flag is specified", bundler: "< 3" do + context "when --install flag is specified", bundler: "2" do it "removes gems from .bundle" do gemfile <<-G source "https://gem.repo1" diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index 0ff9416757..33ba0a2c04 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle show", bundler: "< 3" do +RSpec.describe "bundle show", bundler: "2" do context "with a standard Gemfile" do before :each do install_gemfile <<-G @@ -219,6 +219,6 @@ RSpec.describe "bundle show", bundler: "< 3" do end end -RSpec.describe "bundle show", bundler: "3" do +RSpec.describe "bundle show", bundler: "4" do pending "shows a friendly error about the command removal" end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index e3624ca04d..b9c3cd46f9 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -772,7 +772,7 @@ RSpec.describe "bundle update" do G end - it "should fail loudly", bundler: "< 3" do + it "should fail loudly", bundler: "2" do bundle "install --deployment" bundle "update", all: true, raise_on_error: false @@ -1036,7 +1036,7 @@ RSpec.describe "bundle update" do end end - context "with multiple, duplicated sources, with lockfile in old format", bundler: "< 3" do + context "with multiple, duplicated sources, with lockfile in old format", bundler: "2" do before do build_repo2 do build_gem "dotenv", "2.7.6" @@ -1558,7 +1558,7 @@ RSpec.describe "bundle update --bundler" do G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.99.9") - bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true + bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil } expect(out).to include("Updating bundler to 999.0.0") expect(out).to include("Running `bundle update --bundler \"> 0.a\" --verbose` with bundler 999.0.0") diff --git a/spec/bundler/commands/version_spec.rb b/spec/bundler/commands/version_spec.rb index 307058a5dd..e62c0baf8b 100644 --- a/spec/bundler/commands/version_spec.rb +++ b/spec/bundler/commands/version_spec.rb @@ -10,36 +10,36 @@ RSpec.describe "bundle version" do end context "with -v" do - it "outputs the version", bundler: "< 3" do + it "outputs the version", bundler: "2" do bundle "-v" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", bundler: "3" do + it "outputs the version", bundler: "4" do bundle "-v" expect(out).to eq(Bundler::VERSION) end end context "with --version" do - it "outputs the version", bundler: "< 3" do + it "outputs the version", bundler: "2" do bundle "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", bundler: "3" do + it "outputs the version", bundler: "4" do bundle "--version" expect(out).to eq(Bundler::VERSION) end end context "with version" do - it "outputs the version with build metadata", bundler: "< 3" do + it "outputs the version with build metadata", bundler: "2" do bundle "version" expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end - it "outputs the version with build metadata", bundler: "3" do + it "outputs the version with build metadata", bundler: "4" do bundle "version" expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb index 712ded4bc4..bc02d0465d 100644 --- a/spec/bundler/commands/viz_spec.rb +++ b/spec/bundler/commands/viz_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot") do +RSpec.describe "bundle viz", bundler: "2", if: Bundler.which("dot") do before do realworld_system_gems "ruby-graphviz --version 1.2.5" end 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 diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index 6e3232d3de..8e9ee7dc31 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -109,7 +109,7 @@ RSpec.describe "the lockfile format" do #{version} L - install_gemfile <<-G, verbose: true, preserve_ruby_flags: true + install_gemfile <<-G, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil } source "https://gem.repo4" gem "myrack" diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 036c855c4e..1d8c7bad80 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -17,14 +17,14 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", bundler: "< 3" do + it "is deprecated in favor of .unbundled_env", bundler: "2" do expect(deprecations).to include \ "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \ "(called at -e:1)" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".with_clean_env" do @@ -33,7 +33,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", bundler: "< 3" do + it "is deprecated in favor of .unbundled_env", bundler: "2" do expect(deprecations).to include( "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \ @@ -41,7 +41,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".clean_system" do @@ -50,7 +50,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_system", bundler: "< 3" do + it "is deprecated in favor of .unbundled_system", bundler: "2" do expect(deprecations).to include( "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \ @@ -58,7 +58,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".clean_exec" do @@ -67,7 +67,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_exec", bundler: "< 3" do + it "is deprecated in favor of .unbundled_exec", bundler: "2" do expect(deprecations).to include( "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \ @@ -75,7 +75,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe ".environment" do @@ -84,11 +84,11 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .load", bundler: "< 3" do + it "is deprecated in favor of .load", bundler: "2" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end end @@ -97,11 +97,11 @@ RSpec.describe "major deprecations" do bundle "exec --no-keep-file-descriptors -e 1", raise_on_error: false end - it "is deprecated", bundler: "< 3" do + it "is deprecated", bundler: "2" do expect(deprecations).to include "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" end - pending "is removed and shows a helpful error message about it", bundler: "3" + pending "is removed and shows a helpful error message about it", bundler: "4" end describe "bundle update --quiet" do @@ -121,7 +121,7 @@ RSpec.describe "major deprecations" do bundle "check --path vendor/bundle", raise_on_error: false end - it "should print a deprecation warning", bundler: "< 3" do + it "should print a deprecation warning", bundler: "2" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -130,7 +130,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle check --path=" do @@ -143,7 +143,7 @@ RSpec.describe "major deprecations" do bundle "check --path=vendor/bundle", raise_on_error: false end - it "should print a deprecation warning", bundler: "< 3" do + it "should print a deprecation warning", bundler: "2" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -152,7 +152,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle cache --all" do @@ -165,7 +165,7 @@ RSpec.describe "major deprecations" do bundle "cache --all", raise_on_error: false end - it "should print a deprecation warning", bundler: "< 3" do + it "should print a deprecation warning", bundler: "2" do expect(deprecations).to include( "The `--all` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -174,7 +174,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle cache --path" do @@ -187,7 +187,7 @@ RSpec.describe "major deprecations" do bundle "cache --path foo", raise_on_error: false end - it "should print a deprecation warning", bundler: "< 3" do + it "should print a deprecation warning", bundler: "2" do expect(deprecations).to include( "The `--path` flag is deprecated because its semantics are unclear. " \ "Use `bundle config cache_path` to configure the path of your cache of gems, " \ @@ -196,7 +196,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "bundle config" do @@ -205,11 +205,11 @@ RSpec.describe "major deprecations" do bundle "config" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old get interface" do @@ -217,11 +217,11 @@ RSpec.describe "major deprecations" do bundle "config waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface" do @@ -229,11 +229,11 @@ RSpec.describe "major deprecations" do bundle "config waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface with --local" do @@ -241,11 +241,11 @@ RSpec.describe "major deprecations" do bundle "config --local waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old set interface with --global" do @@ -253,11 +253,11 @@ RSpec.describe "major deprecations" do bundle "config --global waka wakapun" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface" do @@ -265,11 +265,11 @@ RSpec.describe "major deprecations" do bundle "config --delete waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface with --local" do @@ -277,11 +277,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --local waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end describe "old unset interface with --global" do @@ -289,11 +289,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --global waka" end - it "warns", bundler: "3" do + it "warns", bundler: "4" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end end @@ -305,12 +305,12 @@ RSpec.describe "major deprecations" do G end - it "warns when no options are given", bundler: "3" do + it "warns when no options are given", bundler: "4" do bundle "update" expect(deprecations).to include("Pass --all to `bundle update` to update everything") end - pending "fails with a helpful error when no options are given", bundler: "3" + pending "fails with a helpful error when no options are given", bundler: "4" it "does not warn when --all is passed" do bundle "update --all" @@ -326,11 +326,11 @@ RSpec.describe "major deprecations" do G end - it "should output a deprecation warning", bundler: "< 3" do + it "should output a deprecation warning", bundler: "2" do expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle install with both gems.rb and Gemfile present" do @@ -390,7 +390,7 @@ RSpec.describe "major deprecations" do bundle "install #{flag_name} #{value}" end - it "should print a deprecation warning", bundler: "< 3" do + it "should print a deprecation warning", bundler: "2" do expect(deprecations).to include( "The `#{flag_name}` flag is deprecated because it relies on " \ "being remembered across bundler invocations, which bundler " \ @@ -399,7 +399,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end end end @@ -412,7 +412,7 @@ RSpec.describe "major deprecations" do G end - it "shows a deprecation", bundler: "< 3" do + it "shows a deprecation", bundler: "2" do expect(deprecations).to include( "Your Gemfile contains multiple global sources. " \ "Using `source` more than once without a block is a security risk, and " \ @@ -421,7 +421,7 @@ RSpec.describe "major deprecations" do ) end - it "doesn't show lockfile deprecations if there's a lockfile", bundler: "< 3" do + it "doesn't show lockfile deprecations if there's a lockfile", bundler: "2" do bundle "install" expect(deprecations).to include( @@ -449,7 +449,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do @@ -485,13 +485,13 @@ RSpec.describe "major deprecations" do bundle "config set --local frozen true" end - it "shows a deprecation", bundler: "< 3" do + it "shows a deprecation", bundler: "2" do bundle "install" expect(deprecations).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "when Bundler.setup is run in a ruby script" do @@ -524,14 +524,14 @@ RSpec.describe "major deprecations" do RUBY end - it "should print a capistrano deprecation warning", bundler: "< 3" do + it "should print a capistrano deprecation warning", bundler: "2" do expect(deprecations).to include("Bundler no longer integrates " \ "with Capistrano, but Capistrano provides " \ "its own integration with Bundler via the " \ "capistrano-bundler gem. Use it instead.") end - pending "fails with a helpful error", bundler: "3" + pending "fails with a helpful error", bundler: "4" end context "bundle show" do @@ -547,11 +547,11 @@ RSpec.describe "major deprecations" do bundle "show --outdated" end - it "prints a deprecation warning informing about its removal", bundler: "< 3" do + it "prints a deprecation warning informing about its removal", bundler: "2" do expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end end @@ -564,13 +564,13 @@ RSpec.describe "major deprecations" do end context "with --install" do - it "shows a deprecation warning", bundler: "< 3" do + it "shows a deprecation warning", bundler: "2" do bundle "remove myrack --install" expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end end @@ -581,11 +581,11 @@ RSpec.describe "major deprecations" do bundle "viz" end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do expect(deprecations).to include "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph" end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end context "bundle plugin install --local_git" do @@ -595,14 +595,14 @@ RSpec.describe "major deprecations" do end end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do bundle "plugin install foo --local_git #{lib_path("foo-1.0")}" expect(out).to include("Installed plugin foo") expect(deprecations).to include "--local_git is deprecated, use --git" end - pending "fails with a helpful message", bundler: "3" + pending "fails with a helpful message", bundler: "4" end describe "deprecating rubocop" do @@ -616,7 +616,7 @@ RSpec.describe "major deprecations" do bundle "gem my_new_gem --rubocop", raise_on_error: false end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do expect(deprecations).to include \ "--rubocop is deprecated, use --linter=rubocop" end @@ -627,7 +627,7 @@ RSpec.describe "major deprecations" do bundle "gem my_new_gem --no-rubocop", raise_on_error: false end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do expect(deprecations).to include \ "--no-rubocop is deprecated, use --linter" end @@ -638,7 +638,7 @@ RSpec.describe "major deprecations" do bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "true" }, raise_on_error: false end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do expect(deprecations).to include \ "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead" end @@ -649,7 +649,7 @@ RSpec.describe "major deprecations" do bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "false" }, raise_on_error: false end - it "prints a deprecation warning", bundler: "< 3" do + it "prints a deprecation warning", bundler: "2" do expect(deprecations).to include \ "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead" end diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index d0de607e6c..6464ce94b4 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -204,7 +204,7 @@ RSpec.describe "bundler plugin install" do plugin_should_be_installed("foo") end - it "raises an error when both git and local git sources are specified", bundler: "< 3" do + it "raises an error when both git and local git sources are specified", bundler: "2" do bundle "plugin install foo --git /phony/path/project --local_git [email protected]:/repo/project", raise_on_error: false expect(exitstatus).not_to eq(0) diff --git a/spec/bundler/realworld/slow_perf_spec.rb b/spec/bundler/realworld/slow_perf_spec.rb index 32e266ff1b..d9d1aef81c 100644 --- a/spec/bundler/realworld/slow_perf_spec.rb +++ b/spec/bundler/realworld/slow_perf_spec.rb @@ -131,7 +131,7 @@ RSpec.describe "bundle install with complex dependencies", realworld: true do end G - if Bundler.feature_flag.bundler_3_mode? + if Bundler.feature_flag.bundler_4_mode? bundle "lock", env: { "DEBUG_RESOLVER" => "1" }, raise_on_error: false expect(out).to include("backtracking").exactly(26).times diff --git a/spec/bundler/runtime/env_helpers_spec.rb b/spec/bundler/runtime/env_helpers_spec.rb index ce74ba8c19..9280a43334 100644 --- a/spec/bundler/runtime/env_helpers_spec.rb +++ b/spec/bundler/runtime/env_helpers_spec.rb @@ -139,7 +139,7 @@ RSpec.describe "env helpers" do it_behaves_like "an unbundling helper" end - describe "Bundler.clean_env", bundler: 2 do + describe "Bundler.clean_env", bundler: "2" do let(:modified_env) { "Bundler.clean_env" } it_behaves_like "an unbundling helper" @@ -161,7 +161,7 @@ RSpec.describe "env helpers" do end end - describe "Bundler.with_clean_env", bundler: 2 do + describe "Bundler.with_clean_env", bundler: "2" do it "should set ENV to unbundled_env in the block" do expected = Bundler.unbundled_env @@ -212,7 +212,7 @@ RSpec.describe "env helpers" do end end - describe "Bundler.clean_system", bundler: 2 do + describe "Bundler.clean_system", bundler: "2" do before do create_file("source.rb", <<-'RUBY') Bundler.ui.silence { Bundler.clean_system("ruby", "-e", "exit(42) unless ENV['BUNDLE_FOO'] == 'bar'") } @@ -263,7 +263,7 @@ RSpec.describe "env helpers" do end end - describe "Bundler.clean_exec", bundler: 2 do + describe "Bundler.clean_exec", bundler: "2" do before do create_file("source.rb", <<-'RUBY') Process.fork do diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb index a4226ed51e..6f7bb524f2 100644 --- a/spec/bundler/runtime/executable_spec.rb +++ b/spec/bundler/runtime/executable_spec.rb @@ -96,7 +96,7 @@ RSpec.describe "Running bin/* commands" do expect(bundled_app("bin/myrackup")).not_to exist end - it "allows you to stop installing binstubs", bundler: "< 3" do + it "allows you to stop installing binstubs", bundler: "2" do skip "delete permission error" if Gem.win_platform? bundle "install --binstubs bin/" @@ -109,7 +109,7 @@ RSpec.describe "Running bin/* commands" do expect(out).to include("You have not configured a value for `bin`") end - it "remembers that the option was specified", bundler: "< 3" do + it "remembers that the option was specified", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "activesupport" diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb index a481ae3a4d..4b2ac2afc3 100644 --- a/spec/bundler/runtime/self_management_spec.rb +++ b/spec/bundler/runtime/self_management_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "Self management" do "9.4.0" end - before do + around do |example| build_repo4 do build_bundler previous_minor @@ -26,6 +26,8 @@ RSpec.describe "Self management" do G pristine_system_gems "bundler-#{current_version}" + + with_env_vars("BUNDLER_4_MODE" => nil, &example) end it "installs locked version when using system path and uses it" do diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index e47e64de29..cbb31f7350 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1406,7 +1406,6 @@ end describe "default gem activation" do let(:exemptions) do exempts = %w[did_you_mean bundler uri pathname] - exempts << "etc" if (Gem.ruby_version < Gem::Version.new("3.2") || Gem.ruby_version >= Gem::Version.new("3.3.2")) && Gem.win_platform? exempts << "error_highlight" # added in Ruby 3.1 as a default gem exempts << "ruby2_keywords" # added in Ruby 3.1 as a default gem exempts << "syntax_suggest" # added in Ruby 3.2 as a default gem @@ -1525,7 +1524,7 @@ end end describe "after setup" do - it "allows calling #gem on random objects", bundler: "< 3" do + it "allows calling #gem on random objects", bundler: "2" do install_gemfile <<-G source "https://gem.repo1" gem "myrack" @@ -1540,7 +1539,7 @@ end expect(out).to eq("myrack-1.0.0") end - it "keeps Kernel#gem private", bundler: "3" do + it "keeps Kernel#gem private", bundler: "4" do install_gemfile <<-G source "https://gem.repo1" gem "myrack" diff --git a/spec/bundler/support/checksums.rb b/spec/bundler/support/checksums.rb index f3aa13ca9f..8e0dea4a71 100644 --- a/spec/bundler/support/checksums.rb +++ b/spec/bundler/support/checksums.rb @@ -58,7 +58,7 @@ module Spec begin enabled = (target_lockfile || lockfile).match?(/^CHECKSUMS$/) rescue Errno::ENOENT - enabled = Bundler.feature_flag.bundler_3_mode? + enabled = Bundler.feature_flag.bundler_4_mode? end checksums_section(enabled, &block) end diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index b08a68f111..e8eb71d73a 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -265,7 +265,7 @@ module Spec def replace_version_file(version, dir: source_root) version_file = File.expand_path("lib/bundler/version.rb", dir) contents = File.read(version_file) - contents.sub!(/(^\s+VERSION\s*=\s*)"#{Gem::Version::VERSION_PATTERN}"/, %(\\1"#{version}")) + contents.sub!(/(^\s+VERSION\s*=\s*).*$/, %(\\1"#{version}")) File.open(version_file, "w") {|f| f << contents } end diff --git a/spec/bundler/update/redownload_spec.rb b/spec/bundler/update/redownload_spec.rb index 66437fb938..6f99a0c214 100644 --- a/spec/bundler/update/redownload_spec.rb +++ b/spec/bundler/update/redownload_spec.rb @@ -9,12 +9,12 @@ RSpec.describe "bundle update" do end describe "with --force" do - it "shows a deprecation when single flag passed", bundler: 2 do + it "shows a deprecation when single flag passed", bundler: "2" do bundle "update myrack --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end - it "shows a deprecation when multiple flags passed", bundler: 2 do + it "shows a deprecation when multiple flags passed", bundler: "2" do bundle "update myrack --no-color --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end |