diff options
Diffstat (limited to 'spec')
48 files changed, 255 insertions, 406 deletions
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index e14442b25a..6a505358d1 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message", :bundler => "2" do + it "prints a concise help message", :bundler => "3" do bundle! "" expect(last_command.stderr).to be_empty expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}"). @@ -161,12 +161,12 @@ To install the latest version, run `gem install bundler --pre` end RSpec.describe "bundler executable" do - it "shows the bundler version just as the `bundle` executable does", :bundler => "< 2" do + it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do bundler "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "shows the bundler version just as the `bundle` executable does", :bundler => "2" do + it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do bundler "--version" expect(out).to eq(Bundler::VERSION) end diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 163ec507b0..f048728a9f 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Bundler::Definition do end describe "detects changes" do - it "for a path gem with changes", :bundler => "< 2" do + it "for a path gem with changes", :bundler => "< 3" do build_lib "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -72,7 +72,7 @@ RSpec.describe Bundler::Definition do G end - it "for a path gem with changes", :bundler => "2" do + it "for a path gem with changes", :bundler => "3" do build_lib "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index bc40ab94b2..a17bfd4938 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -61,20 +61,26 @@ RSpec.describe Bundler::Dsl do it_behaves_like "the github DSL", "https" end - context "when github.https config is false" do + context "when github.https config is false", :bundler => "2" do before { bundle "config set github.https false" } it_behaves_like "the github DSL", "git" end - context "by default", :bundler => "< 2" do - it_behaves_like "the github DSL", "git" + context "when github.https config is false", :bundler => "3" do + before { bundle "config set github.https false" } + + pending "should show a proper message about the removed setting" end context "by default", :bundler => "2" do it_behaves_like "the github DSL", "https" end + context "by default", :bundler => "3" do + it_behaves_like "the github DSL", "https" + end + it "converts numeric :gist to :git" do subject.gem("not-really-a-gem", :gist => 2_859_988) github_uri = "https://gist.github.com/2859988.git" @@ -266,7 +272,7 @@ RSpec.describe Bundler::Dsl do # gem 'spree_api' # gem 'spree_backend' # end - describe "#github", :bundler => "< 2" do + describe "#github", :bundler => "< 3" do it "from github" do spree_gems = %w[spree_core spree_api spree_backend] subject.github "spree" do @@ -274,12 +280,12 @@ RSpec.describe Bundler::Dsl do end subject.dependencies.each do |d| - expect(d.source.uri).to eq("git://github.com/spree/spree.git") + expect(d.source.uri).to eq("https://github.com/spree/spree.git") end end end - describe "#github", :bundler => "2" do + describe "#github", :bundler => "3" do it "from github" do spree_gems = %w[spree_core spree_api spree_backend] subject.github "spree" do diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb index 7df4ba82d3..a78b80ec3b 100644 --- a/spec/bundler/source_list_spec.rb +++ b/spec/bundler/source_list_spec.rb @@ -115,7 +115,7 @@ RSpec.describe Bundler::SourceList do end end - describe "#add_rubygems_remote", :bundler => "< 2" do + describe "#add_rubygems_remote", :bundler => "< 3" do let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") } it "returns the aggregate rubygems source" do diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb index 951a446aff..23a7670dd1 100644 --- a/spec/bundler/ui/shell_spec.rb +++ b/spec/bundler/ui/shell_spec.rb @@ -21,11 +21,7 @@ RSpec.describe Bundler::UI::Shell do describe "#warn" do before { subject.level = "warn" } - it "prints to stdout", :bundler => "< 2" do - expect { subject.warn("warning") }.to output("warning\n").to_stdout - end - - it "prints to stderr", :bundler => "2" do + it "prints to stderr" do expect { subject.warn("warning") }.to output("warning\n").to_stderr end @@ -46,11 +42,7 @@ RSpec.describe Bundler::UI::Shell do describe "#error" do before { subject.level = "error" } - it "prints to stdout", :bundler => "< 2" do - expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout - end - - it "prints to stderr", :bundler => "2" do + it "prints to stderr" do expect { subject.error("error!!!") }.to output("error!!!\n").to_stderr end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 4ed519b9d6..55a24ff118 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -168,7 +168,7 @@ end expect(the_bundle).to include_gems "has_submodule 1.0" end - it "displays warning message when detecting git repo in Gemfile", :bundler => "< 2" do + it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do build_git "foo" install_gemfile <<-G @@ -177,7 +177,7 @@ end bundle "#{cmd}" - expect(out).to include("Your Gemfile contains path and git dependencies.") + expect(err).to include("Your Gemfile contains path and git dependencies.") end it "does not display warning message if cache_all is set in bundle config" do @@ -190,7 +190,7 @@ end bundle cmd, forgotten_command_line_options([:all, :cache_all] => true) bundle cmd - expect(out).not_to include("Your Gemfile contains path and git dependencies.") + expect(err).not_to include("Your Gemfile contains path and git dependencies.") end it "caches pre-evaluated gemspecs" do diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 8c6a843476..0d7b154a37 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -86,7 +86,7 @@ expect(bundled_app("vendor/cache/bar-1.0")).not_to exist end - it "raises a warning without --all", :bundler => "< 2" do + it "raises a warning without --all", :bundler => "< 3" do build_lib "foo" install_gemfile <<-G @@ -94,7 +94,7 @@ G bundle cmd - expect(out).to match(/please pass the \-\-all flag/) + expect(err).to match(/please pass the \-\-all flag/) expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 9126b29592..3f62f17b45 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -294,7 +294,7 @@ RSpec.describe "bundle binstubs <gem>" do expect(bundled_app("exec/rackup")).to exist end - it "setting is saved for bundle install", :bundler => "< 2" do + it "setting is saved for bundle install", :bundler => "< 3" do install_gemfile <<-G source "file://#{gem_repo1}" gem "rack" diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb index aec6207c70..7114610644 100644 --- a/spec/commands/check_spec.rb +++ b/spec/commands/check_spec.rb @@ -92,7 +92,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 => "< 2" do + it "remembers --without option from install", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" group :foo do @@ -238,7 +238,7 @@ RSpec.describe "bundle check" do expect(last_command).to be_failure end - context "--path", :bundler => "< 2" do + context "--path", :bundler => "< 3" do before do gemfile <<-G source "file://#{gem_repo1}" @@ -254,7 +254,7 @@ RSpec.describe "bundle check" do expect(out).to include("The Gemfile's dependencies are satisfied") end - it "should write to .bundle/config", :bundler => "< 2" do + it "should write to .bundle/config", :bundler => "< 3" do bundle "check --path vendor/bundle" bundle! "check" end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index b7c23b8136..cd5cb932e3 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -142,7 +142,7 @@ RSpec.describe "bundle clean" do bundle :clean digest = Digest(:SHA1).hexdigest(git_path.to_s) - cache_path = Bundler::VERSION.start_with?("1.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") + cache_path = Bundler::VERSION.start_with?("2.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") expect(cache_path).to exist end @@ -344,7 +344,7 @@ RSpec.describe "bundle clean" do expect(out).to include("rack (1.0.0)").and include("thin (1.0)") end - it "--clean should override the bundle setting on install", :bundler => "< 2" do + it "--clean should override the bundle setting on install", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" @@ -364,7 +364,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "thin-1.0" end - it "--clean should override the bundle setting on update", :bundler => "< 2" do + it "--clean should override the bundle setting on update", :bundler => "< 3" do build_repo2 gemfile <<-G @@ -384,7 +384,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", :bundler => "2" do + it "automatically cleans when path has not been set", :bundler => "3" do build_repo2 install_gemfile! <<-G diff --git a/spec/commands/console_spec.rb b/spec/commands/console_spec.rb index 41fc56c919..cba618db80 100644 --- a/spec/commands/console_spec.rb +++ b/spec/commands/console_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle console", :bundler => "< 2" do +RSpec.describe "bundle console", :bundler => "< 3" do before :each do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index bf1de25142..1d84669a75 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -621,17 +621,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable is empty", :bundler => "< 2" do - let(:executable) { "" } - - let(:exit_code) { 0 } - let(:expected) { "#{path} is empty" } - let(:expected_err) { "" } - - it_behaves_like "it runs" - end - - context "the executable is empty", :bundler => "2" do + context "the executable is empty" do let(:executable) { "" } let(:exit_code) { 0 } @@ -640,18 +630,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises", :bundler => "< 2" do - let(:executable) { super() << "\nraise 'ERROR'" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) do - "RuntimeError: ERROR\n #{path}:10" + - (Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'") - end - it_behaves_like "it runs" - end - - context "the executable raises", :bundler => "2" do + context "the executable raises" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected_err) do @@ -661,16 +640,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises an error without a backtrace", :bundler => "< 2" do - let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) { "Err: Err" } - - it_behaves_like "it runs" - end - - context "the executable raises an error without a backtrace", :bundler => "2" do + context "the executable raises an error without a backtrace" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } @@ -684,25 +654,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "when Bundler.setup fails", :bundler => "< 2" do - before do - gemfile <<-G - gem 'rack', '2' - G - ENV["BUNDLER_FORCE_TTY"] = "true" - end - - let(:exit_code) { Bundler::GemNotFound.new.status_code } - let(:expected_err) { "" } - let(:expected) { <<-EOS.strip } -\e[31mCould not find gem 'rack (= 2)' in any of the gem sources listed in your Gemfile.\e[0m -\e[33mRun `bundle install` to install missing gems.\e[0m - EOS - - it_behaves_like "it runs" - end - - context "when Bundler.setup fails", :bundler => "2" do + context "when Bundler.setup fails", :bundler => "< 3" do before do gemfile <<-G gem 'rack', '2' diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb index 3685cd9c36..18f77f29fd 100644 --- a/spec/commands/init_spec.rb +++ b/spec/commands/init_spec.rb @@ -1,19 +1,19 @@ # frozen_string_literal: true RSpec.describe "bundle init" do - it "generates a Gemfile", :bundler => "< 2" do + it "generates a Gemfile", :bundler => "< 3" do bundle! :init expect(out).to include("Writing new Gemfile") expect(bundled_app("Gemfile")).to be_file end - it "generates a gems.rb", :bundler => "2" do + it "generates a gems.rb", :bundler => "3" do bundle! :init expect(out).to include("Writing new gems.rb") expect(bundled_app("gems.rb")).to be_file end - context "when a Gemfile already exists", :bundler => "< 2" do + context "when a Gemfile already exists", :bundler => "< 3" do before do create_file "Gemfile", <<-G gem "rails" @@ -30,7 +30,7 @@ RSpec.describe "bundle init" do end end - context "when gems.rb already exists", :bundler => ">= 2" do + context "when gems.rb already exists", :bundler => ">= 3" do before do create_file("gems.rb", <<-G) gem "rails" @@ -47,7 +47,7 @@ RSpec.describe "bundle init" do end end - context "when a Gemfile exists in a parent directory", :bundler => "< 2" do + context "when a Gemfile exists in a parent directory", :bundler => "< 3" do let(:subdir) { "child_dir" } it "lets users generate a Gemfile in a child directory" do @@ -82,7 +82,7 @@ RSpec.describe "bundle init" do end end - context "when a gems.rb file exists in a parent directory", :bundler => ">= 2" do + context "when a gems.rb file exists in a parent directory", :bundler => ">= 3" do let(:subdir) { "child_dir" } it "lets users generate a Gemfile in a child directory" do @@ -99,7 +99,7 @@ RSpec.describe "bundle init" do end end - context "given --gemspec option", :bundler => "< 2" do + context "given --gemspec option", :bundler => "< 3" do let(:spec_file) { tmp.join("test.gemspec") } it "should generate from an existing gemspec" do @@ -115,7 +115,7 @@ RSpec.describe "bundle init" do bundle :init, :gemspec => spec_file - gemfile = if Bundler::VERSION[0, 2] == "1." + gemfile = if Bundler::VERSION[0, 2] == "2." bundled_app("Gemfile").read else bundled_app("gems.rb").read @@ -146,7 +146,7 @@ RSpec.describe "bundle init" do context "when init_gems_rb setting is enabled" do before { bundle "config set init_gems_rb true" } - context "given --gemspec option", :bundler => "< 2" do + context "given --gemspec option", :bundler => "< 3" do let(:spec_file) { tmp.join("test.gemspec") } before do diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index 7ae0369955..da31849be7 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle inject", :bundler => "< 2" do +RSpec.describe "bundle inject", :bundler => "< 3" do before :each do gemfile <<-G source "file://#{gem_repo1}" @@ -37,14 +37,14 @@ RSpec.describe "bundle inject", :bundler => "< 2" do context "with injected gems already in the Gemfile" do it "doesn't add existing gems" do bundle "inject 'rack' '> 0'" - expect(out).to match(/cannot specify the same gem twice/i) + expect(err).to match(/cannot specify the same gem twice/i) end end context "incorrect arguments" do it "fails when more than 2 arguments are passed" do bundle "inject gem_name 1 v" - expect(out).to eq(<<-E.strip) + expect(err).to eq(<<-E.strip) ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"] Usage: "bundle inject GEM VERSION" E @@ -79,7 +79,7 @@ Usage: "bundle inject GEM VERSION" context "when frozen" do before do bundle "install" - if Bundler.feature_flag.bundler_2_mode? + if Bundler.feature_flag.bundler_3_mode? bundle! "config set --local deployment true" else bundle! "config set --local frozen true" @@ -109,7 +109,7 @@ Usage: "bundle inject GEM VERSION" gem "rack-obama" G bundle "inject 'rack' '> 0'" - expect(out).to match(/trying to install in deployment mode after changing/) + expect(err).to match(/trying to install in deployment mode after changing/) expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) end diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index c198797862..21157dd309 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app("Gemfile.lock")).to exist end - it "does not create ./.bundle by default", :bundler => "< 2" do + it "does not create ./.bundle by default", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -275,14 +275,14 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system without deleting foo", :bundler => "< 2" do + it "allows running bundle install --system without deleting foo", :bundler => "< 3" do bundle "install", forgotten_command_line_options(:path => "vendor") bundle "install", forgotten_command_line_options(:system => true) FileUtils.rm_rf(bundled_app("vendor")) expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system after deleting foo", :bundler => "< 2" do + it "allows running bundle install --system after deleting foo", :bundler => "< 3" do bundle "install", forgotten_command_line_options(:path => "vendor") FileUtils.rm_rf(bundled_app("vendor")) bundle "install", forgotten_command_line_options(:system => true) @@ -290,7 +290,7 @@ RSpec.describe "bundle install with gem sources" do end end - it "finds gems in multiple sources", :bundler => "< 2" do + it "finds gems in multiple sources", :bundler => "< 3" do build_repo2 update_repo2 diff --git a/spec/commands/list_spec.rb b/spec/commands/list_spec.rb index e88d7bfb04..346b47517e 100644 --- a/spec/commands/list_spec.rb +++ b/spec/commands/list_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle list", :bundler => ">= 2" do +RSpec.describe "bundle list" do context "with name-only and paths option" do it "raises an error" do bundle "list --name-only --paths" diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index 48a984a879..843bebf6e0 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -419,7 +419,7 @@ RSpec.describe "bundle outdated" do expect(out).to include("Installing foo 1.0") end - context "after bundle install --deployment", :bundler => "< 2" do + context "after bundle install --deployment", :bundler => "< 3" do before do install_gemfile <<-G, forgotten_command_line_options(:deployment => true) source "file://#{gem_repo2}" diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index b0b451b582..6cd8e3f85a 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -141,7 +141,7 @@ RSpec.describe "bundle package" do end end - context "with --path", :bundler => "< 2" do + context "with --path", :bundler => "< 3" do it "sets root directory for gems" do gemfile <<-D source "file://#{gem_repo1}" diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index d747fb9844..93eb81f2af 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -48,7 +48,14 @@ RSpec.describe "bundle pristine", :ruby_repo do bundle! "install" bundle! "pristine", :system_bundler => true bundle! "-v", :system_bundler => true - expect(out).to end_with(Bundler::VERSION) + + expected = if Bundler::VERSION < "3.0" + "Bundler version" + else + Bundler::VERSION + end + + expect(out).to start_with(expected) end end diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index 6634a3f7ed..8fb6631f82 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -30,7 +30,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "prints deprecation", :bundler => "2" do + it "prints deprecation" do bundle "show rails" expect(err).to eq("[DEPRECATED] use `bundle info rails` instead of `bundle show rails`") end @@ -40,7 +40,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "prints deprecation when called with a gem and the --paths option", :bundler => "2" do + it "prints deprecation when called with a gem and the --paths option" do bundle "show rails --paths" expect(err).to eq("[DEPRECATED] use `bundle info rails --path` instead of `bundle show rails --paths`") end @@ -59,7 +59,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do expect(out).to eq(root.to_s) end - it "prints deprecation when called with bundler", :bundler => "2" do + it "prints deprecation when called with bundler" do bundle "show bundler" expect(err).to eq("[DEPRECATED] use `bundle info bundler` instead of `bundle show bundler`") end @@ -79,7 +79,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do expect(gem_list).to eq(gem_list.sort) end - it "prints a deprecation when called with the --paths option", :bundler => 2 do + it "prints a deprecation when called with the --paths option" do bundle "show --paths" expect(err).to eq("[DEPRECATED] use `bundle list` instead of `bundle show --paths`") @@ -226,3 +226,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end end end + +RSpec.describe "bundle show", :bundler => "3" do + pending "shows a friendly error about the command removal" +end diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 243b06e049..46c208db6c 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "bundle update" do G end - describe "with no arguments", :bundler => "< 2" do + describe "with no arguments", :bundler => "< 3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" @@ -35,7 +35,7 @@ RSpec.describe "bundle update" do end end - describe "with --all", :bundler => "2" do + describe "with --all", :bundler => "3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" @@ -280,23 +280,23 @@ RSpec.describe "bundle update" do end describe "in a frozen bundle" do - it "should fail loudly", :bundler => "< 2" do + it "should fail loudly", :bundler => "< 3" do bundle! "install --deployment" bundle "update", :all => true expect(last_command).to be_failure - expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m) - expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m) + expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m) + expect(err).to match(/freeze \nby running `bundle install --no-deployment`./m) end - it "should suggest different command when frozen is set globally", :bundler => "< 2" do + it "should suggest different command when frozen is set globally", :bundler => "< 3" do bundle! "config set --global frozen 1" bundle "update", :all => true - expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). + expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). and match(/freeze \nby running `bundle config unset frozen`./m) end - it "should suggest different command when frozen is set globally", :bundler => "2" do + it "should suggest different command when frozen is set globally", :bundler => "3" do bundle! "config set --global deployment true" bundle "update", :all => true expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). @@ -305,7 +305,7 @@ RSpec.describe "bundle update" do end describe "with --source option" do - it "should not update gems not included in the source that happen to have the same name", :bundler => "< 2" do + it "should not update gems not included in the source that happen to have the same name", :bundler => "< 3" do install_gemfile! <<-G source "file://#{gem_repo2}" gem "activesupport" @@ -316,7 +316,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gem "activesupport 3.0" end - it "should not update gems not included in the source that happen to have the same name", :bundler => "2" do + it "should not update gems not included in the source that happen to have the same name", :bundler => "3" do install_gemfile! <<-G source "file://#{gem_repo2}" gem "activesupport" @@ -359,7 +359,7 @@ RSpec.describe "bundle update" do G end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do update_repo2 do build_gem "fred", "2.0" build_gem "harry", "2.0" do |s| @@ -372,7 +372,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gems "fred 1.0" end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do update_repo2 do build_gem "fred", "2.0" build_gem "harry", "2.0" do |s| @@ -404,7 +404,7 @@ RSpec.describe "bundle update" do G end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do update_repo2 do build_gem "george", "2.0" build_gem "harry", "2.0" do |s| @@ -418,7 +418,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gems "george 1.0" end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do update_repo2 do build_gem "george", "2.0" build_gem "harry", "2.0" do |s| @@ -562,14 +562,14 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" G end - it "should explain that bundler conflicted", :bundler => "< 2" do + it "should explain that bundler conflicted", :bundler => "< 3" do bundle "update", :all => true expect(last_command.stdboth).not_to match(/in snapshot/i) expect(last_command.bundler_err).to match(/current Bundler version/i). and match(/perhaps you need to update bundler/i) end - it "should warn that the newer version of Bundler would conflict", :bundler => "2" do + it "should warn that the newer version of Bundler would conflict", :bundler => "3" do bundle! "update", :all => true expect(last_command.bundler_err).to include("rails (3.0.1) has dependency bundler"). and include("so the dependency is being ignored") @@ -578,7 +578,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end RSpec.describe "bundle update" do - it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 2" do + it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 3" do build_repo2 install_gemfile <<-G diff --git a/spec/commands/version_spec.rb b/spec/commands/version_spec.rb index b919c25e0f..66c7930397 100644 --- a/spec/commands/version_spec.rb +++ b/spec/commands/version_spec.rb @@ -2,36 +2,36 @@ RSpec.describe "bundle version" do context "with -v" do - it "outputs the version", :bundler => "< 2" do + it "outputs the version", :bundler => "< 3" do bundle! "-v" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "2" do + it "outputs the version", :bundler => "3" do bundle! "-v" expect(out).to eq(Bundler::VERSION) end end context "with --version" do - it "outputs the version", :bundler => "< 2" do + it "outputs the version", :bundler => "< 3" do bundle! "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "2" do + it "outputs the version", :bundler => "3" do bundle! "--version" expect(out).to eq(Bundler::VERSION) end end context "with version" do - it "outputs the version with build metadata", :bundler => "< 2" do + it "outputs the version with build metadata", :bundler => "< 3" do bundle! "version" expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) end - it "outputs the version with build metadata", :bundler => "2" do + it "outputs the version with build metadata", :bundler => "3" do bundle! "version" expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) end diff --git a/spec/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb index 23eb691ab8..f04d3fe654 100644 --- a/spec/install/binstubs_spec.rb +++ b/spec/install/binstubs_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle install", :bundler => "< 2" do +RSpec.describe "bundle install", :bundler => "< 3" do describe "when system_bindir is set" do # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if # you want to avoid sudo installs for system gems with OS X's default ruby @@ -20,7 +20,7 @@ RSpec.describe "bundle install", :bundler => "< 2" do end end - describe "when multiple gems contain the same exe", :bundler => "< 2" do + describe "when multiple gems contain the same exe", :bundler => "< 3" do before do build_repo2 do build_gem "fake", "14" do |s| diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 8995caa52b..918dbabfbe 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -8,29 +8,29 @@ RSpec.describe "install with --deployment or --frozen" do G end - context "with CLI flags", :bundler => "< 2" do + context "with CLI flags", :bundler => "< 3" do it "fails without a lockfile and says that --deployment requires a lock" do bundle "install --deployment" - expect(out).to include("The --deployment flag requires a Gemfile.lock") + expect(err).to include("The --deployment flag requires a Gemfile.lock") end it "fails without a lockfile and says that --frozen requires a lock" do bundle "install --frozen" - expect(out).to include("The --frozen flag requires a Gemfile.lock") + expect(err).to include("The --frozen flag requires a Gemfile.lock") end it "disallows --deployment --system" do bundle "install --deployment --system" - expect(out).to include("You have specified both --deployment") - expect(out).to include("Please choose only one option") + expect(err).to include("You have specified both --deployment") + expect(err).to include("Please choose only one option") expect(exitstatus).to eq(15) if exitstatus end it "disallows --deployment --path --system" do bundle "install --deployment --path . --system" - expect(out).to include("You have specified both --path") - expect(out).to include("as well as --system") - expect(out).to include("Please choose only one option") + expect(err).to include("You have specified both --path") + expect(err).to include("as well as --system") + expect(err).to include("Please choose only one option") expect(exitstatus).to eq(15) if exitstatus end @@ -109,11 +109,11 @@ RSpec.describe "install with --deployment or --frozen" do bundle "install" end - it "works with the --deployment flag if you didn't change anything", :bundler => "< 2" do + it "works with the --deployment flag if you didn't change anything", :bundler => "< 3" do bundle! "install --deployment" end - it "works with the --frozen flag if you didn't change anything", :bundler => "< 2" do + it "works with the --frozen flag if you didn't change anything", :bundler => "< 3" do bundle! "install --frozen" end @@ -165,7 +165,7 @@ RSpec.describe "install with --deployment or --frozen" do expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") end - it "can have --frozen set via an environment variable", :bundler => "< 2" do + it "can have --frozen set via an environment variable", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -174,11 +174,11 @@ RSpec.describe "install with --deployment or --frozen" do ENV["BUNDLE_FROZEN"] = "1" bundle "install" - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile") - expect(out).to include("* rack-obama") - expect(out).not_to include("You have deleted from the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile") + expect(err).to include("* rack-obama") + expect(err).not_to include("You have deleted from the Gemfile") + expect(err).not_to include("You have changed in the Gemfile") end it "can have --deployment set via an environment variable" do @@ -212,21 +212,6 @@ RSpec.describe "install with --deployment or --frozen" do expect(out).not_to include("* rack-obama") end - it "explodes with the --frozen flag if you make a change and don't check in the lockfile", :bundler => "< 2" do - gemfile <<-G - source "file://#{gem_repo1}" - gem "rack" - gem "rack-obama", "1.1" - G - - bundle :install, forgotten_command_line_options(:frozen => true) - expect(err).to include("deployment mode") - expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama (= 1.1)") - expect(err).not_to include("You have deleted from the Gemfile") - expect(err).not_to include("You have changed in the Gemfile") - end - it "explodes if you remove a gem and don't check in the lockfile" do gemfile <<-G source "file://#{gem_repo1}" @@ -297,11 +282,7 @@ RSpec.describe "install with --deployment or --frozen" do context "when replacing a host with the same host with credentials" do let(:success_message) do - if Bundler::VERSION.split(".", 2).first == "1" - "Could not reach host localgemserver.test" - else - "Bundle complete!" - end + "Bundle complete!" end before do diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 4636c8de08..f208853041 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/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 => "< 2" do + it "caches the git repo", :bundler => "< 3" do expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 end diff --git a/spec/install/gemfile/groups_spec.rb b/spec/install/gemfile/groups_spec.rb index 2787172057..f836499148 100644 --- a/spec/install/gemfile/groups_spec.rb +++ b/spec/install/gemfile/groups_spec.rb @@ -192,22 +192,22 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).not_to include_gems "thin 1.0" end - it "does remove groups from without when passed at --with", :bundler => "< 2" do + it "does remove groups from without when passed at --with", :bundler => "< 3" do bundle :install, forgotten_command_line_options(:without => "emo") bundle :install, forgotten_command_line_options(:with => "emo") expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "does remove groups from with when passed at --without", :bundler => "< 2" do + it "does remove groups from with when passed at --without", :bundler => "< 3" do bundle :install, forgotten_command_line_options(:with => "debugging") bundle :install, forgotten_command_line_options(:without => "debugging") 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 => "< 2" do + it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo") expect(last_command).to be_failure - expect(out).to include("The offending groups are: emo") + expect(err).to include("The offending groups are: emo") end it "allows the BUNDLE_WITH setting to override BUNDLE_WITHOUT" do diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 40c137cd4a..54a41b576f 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/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 => "< 2" do + it "fetches gems with a global path source", :bundler => "< 3" do build_lib "foo" install_gemfile <<-G diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 7757a3c7c4..891f766cc0 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -230,7 +230,7 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end - it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 2" do + it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do simulate_platform x64_mac update_repo2 do @@ -248,7 +248,7 @@ RSpec.describe "bundle install across platforms" do gem "facter" G - expect(out).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \ + expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \ "because it has different dependencies from the ruby version. " \ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again." diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 9f03c2a20f..b94b68dbd9 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -269,7 +269,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(last_command.stdboth).not_to include "Double checking" end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -328,7 +328,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" 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 @@ -352,7 +352,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "activesupport 1.2.3" end - it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 3" 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 @@ -458,7 +458,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -522,7 +522,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rails 2.3.2" end - it "installs the binstubs", :bundler => "< 2" do + it "installs the binstubs", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -534,7 +534,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", :bundler => "< 2" do + it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -545,7 +545,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do + it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -620,7 +620,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do + it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "file://#{gem_repo1}" @@ -628,8 +628,8 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_basic_authentication" - expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") - expect(out).not_to include("#{user}:#{password}") + expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index b7b71055f6..0dc1ee87f2 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -243,7 +243,7 @@ RSpec.describe "gemcutter's dependency API" do end end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -302,7 +302,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" 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 @@ -372,7 +372,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 if the index of gems is large when doing back deps", :bundler => "< 2" do + it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -432,7 +432,7 @@ RSpec.describe "gemcutter's dependency 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", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -496,7 +496,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "rails 2.3.2" end - it "installs the binstubs", :bundler => "< 2" do + it "installs the binstubs", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -508,7 +508,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 => "< 2" do + it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -519,7 +519,7 @@ RSpec.describe "gemcutter's dependency API" do expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do + it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -594,7 +594,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 => "< 2" do + it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "file://#{gem_repo1}" @@ -602,8 +602,8 @@ RSpec.describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_basic_authentication" - expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") - expect(out).not_to include("#{user}:#{password}") + expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 2c7dd09f91..e2cfe5ec4c 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -197,7 +197,7 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end - it "allows --path to change the location of the standalone bundle", :bundler => "< 2" do + it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) Dir.chdir(bundled_app) do @@ -213,7 +213,7 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stdout).to eq("2.3.2") end - it "allows --path to change the location of the standalone bundle", :bundler => "2" do + it "allows --path to change the location of the standalone bundle", :bundler => "3" do bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) path = File.expand_path("path/to/bundle") @@ -273,7 +273,7 @@ RSpec.shared_examples "bundle install --standalone" do end end - describe "with --binstubs", :bundler => "< 2" do + describe "with --binstubs", :bundler => "< 3" do before do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index ac315f51c0..68b2f47c10 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle install" do context "git sources" do - it "displays the revision hash of the gem repository", :bundler => "< 2" do + it "displays the revision hash of the gem repository", :bundler => "< 3" do build_git "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -14,7 +14,7 @@ RSpec.describe "bundle install" do expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" end - it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 2" do + it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do build_git "foo", "1.0", :path => lib_path("foo") rev = revision_for(lib_path("foo"))[0..6] update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index c645ba18a3..0947ed9539 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "bundle install" do G end - it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 2" do + it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 3" do bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -35,13 +35,13 @@ RSpec.describe "bundle install" do expect(out).to include("gems are installed into `./vendor/bundle`") end - it "disallows --path vendor/bundle --system", :bundler => "< 2" do + it "disallows --path vendor/bundle --system", :bundler => "< 3" do bundle "install --path vendor/bundle --system" - expect(out).to include("Please choose only one option.") + expect(err).to include("Please choose only one option.") expect(exitstatus).to eq(15) if exitstatus end - it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 2" do + it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 3" do bundle "install --path vendor/bundle" FileUtils.rm_rf bundled_app("vendor") bundle "install" @@ -53,7 +53,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 => "< 2" do + it "installs the bundle relatively to current working directory", :bundler => "< 3" do Dir.chdir(bundled_app.parent) do bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle" expect(out).to include("installed into `./vendor/bundle`") @@ -113,7 +113,7 @@ RSpec.describe "bundle install" do expect(the_bundle).to include_gems "rack 1.0.0" end - context "with global_path_appends_ruby_scope set", :bundler => "2" do + context "with global_path_appends_ruby_scope set", :bundler => "3" do it "installs gems to ." do set_bundle_path(type, ".") bundle! "config set --global disable_shared_gems true" @@ -147,7 +147,7 @@ RSpec.describe "bundle install" do end end - context "with global_path_appends_ruby_scope unset", :bundler => "< 2" do + context "with global_path_appends_ruby_scope unset", :bundler => "< 3" do it "installs gems to ." do set_bundle_path(type, ".") bundle! "config set --global disable_shared_gems true" diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index 1ea21a6635..1efd0b8146 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "post bundle message" do let(:bundle_complete_message) { "Bundle complete!" } let(:bundle_updated_message) { "Bundle updated!" } let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." } - let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 2 ? bundle_show_system_message : bundle_show_path_message } + let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 3 ? bundle_show_system_message : bundle_show_path_message } describe "for fresh bundle install" do it "without any options" do diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb index de726c4562..2a0cdc9473 100644 --- a/spec/install/redownload_spec.rb +++ b/spec/install/redownload_spec.rb @@ -56,30 +56,20 @@ RSpec.describe "bundle install" do end end - describe "with --force" do + describe "with --force", :bundler => 2 do it_behaves_like "an option to force redownloading gems" do let(:flag) { "force" } end - it "shows a deprecation when single flag passed", :bundler => 2 do + it "shows a deprecation when single flag passed" do bundle! "install --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" do bundle! "install --no-color --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end - - it "does not show a deprecation when single flag passed", :bundler => "< 2" do - bundle! "install --force" - expect(out).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" - end - - it "does not show a deprecation when multiple flags passed", :bundler => "< 2" do - bundle! "install --no-color --force" - expect(out).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" - end end describe "with --redownload" do diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 0bab70066e..5ee44bf779 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -203,7 +203,7 @@ RSpec.describe "the lockfile format" do G end - it "errors if the current is a major version older than lockfile's bundler version", :bundler => "2" do + it "errors if the current is a major version older than lockfile's bundler version", :bundler => "3" do lockfile <<-L GEM remote: file://localhost#{gem_repo1}/ @@ -268,7 +268,7 @@ RSpec.describe "the lockfile format" do expect(err).to include("You must use Bundler 9999999 or greater with this lockfile.") end - it "warns when updating bundler major version", :bundler => "< 2" do + it "warns when updating bundler major version", :bundler => "< 3" do lockfile <<-L GEM remote: file://localhost#{gem_repo1}/ @@ -316,7 +316,7 @@ RSpec.describe "the lockfile format" do G end - it "warns when updating bundler major version", :bundler => "2" do + it "warns when updating bundler major version", :bundler => "3" do lockfile <<-L GEM remote: file://localhost#{gem_repo1}/ @@ -514,7 +514,7 @@ RSpec.describe "the lockfile format" do expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0" end - it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 2" do + it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do git = build_git "foo" install_gemfile <<-G @@ -1064,7 +1064,7 @@ RSpec.describe "the lockfile format" do G end - it "keeps existing platforms in the lockfile", :bundler => "< 2" do + it "keeps existing platforms in the lockfile", :bundler => "< 3" do lockfile <<-G GEM remote: file://localhost#{gem_repo1}/ @@ -1105,7 +1105,7 @@ RSpec.describe "the lockfile format" do G end - it "keeps existing platforms in the lockfile", :bundler => "2" do + it "keeps existing platforms in the lockfile", :bundler => "3" do lockfile <<-G GEM remote: file://localhost#{gem_repo1}/ @@ -1147,7 +1147,7 @@ RSpec.describe "the lockfile format" do G end - it "persists the spec's platform to the lockfile", :bundler => "< 2" do + it "persists the spec's platform to the lockfile", :bundler => "< 3" do build_repo2 do build_gem "platform_specific", "1.0" do |s| s.platform = Gem::Platform.new("universal-java-16") @@ -1178,7 +1178,7 @@ RSpec.describe "the lockfile format" do G end - it "persists the spec's platform and specific platform to the lockfile", :bundler => "2" do + it "persists the spec's platform and specific platform to the lockfile", :bundler => "3" do build_repo2 do build_gem "platform_specific", "1.0" do |s| s.platform = Gem::Platform.new("universal-java-16") diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index cd8b721609..e017c46dfd 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -17,15 +17,13 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is not deprecated", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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`" end + + pending "is removed and shows a helpful error message about it", :bundler => "3" end describe ".with_clean_env" do @@ -34,16 +32,14 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is not deprecated", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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`" ) end + + pending "is removed and shows a helpful error message about it", :bundler => "3" end describe ".clean_system" do @@ -52,16 +48,14 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is not deprecated", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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`" ) end + + pending "is removed and shows a helpful error message about it", :bundler => "3" end describe ".clean_exec" do @@ -70,16 +64,14 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is not deprecated", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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`" ) end + + pending "is removed and shows a helpful error message about it", :bundler => "3" end describe ".environment" do @@ -88,13 +80,11 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is not deprecated", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "is deprecated in favor of .load", :bundler => "2" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load" end + + pending "is removed and shows a helpful error message about it", :bundler => "3" end end @@ -111,13 +101,11 @@ RSpec.describe "major deprecations" do bundle! "config" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old get interface" do @@ -125,13 +113,11 @@ RSpec.describe "major deprecations" do bundle! "config waka" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old set interface" do @@ -139,13 +125,11 @@ RSpec.describe "major deprecations" do bundle! "config waka wakapun" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old set interface with --local" do @@ -153,13 +137,11 @@ RSpec.describe "major deprecations" do bundle! "config --local waka wakapun" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old set interface with --global" do @@ -167,13 +149,11 @@ RSpec.describe "major deprecations" do bundle! "config --global waka wakapun" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old unset interface" do @@ -181,13 +161,11 @@ RSpec.describe "major deprecations" do bundle! "config --delete waka" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old unset interface with --local" do @@ -195,13 +173,11 @@ RSpec.describe "major deprecations" do bundle! "config --delete --local waka" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end describe "old unset interface with --global" do @@ -209,13 +185,11 @@ RSpec.describe "major deprecations" do bundle! "config --delete --global waka" end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "warns", :bundler => "2" 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" end end @@ -227,16 +201,13 @@ RSpec.describe "major deprecations" do G end - it "does not warn when no options are given", :bundler => "< 2" do - bundle! "update" - expect(deprecations).to be_empty - end - it "warns when no options are given", :bundler => "2" 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" + it "does not warn when --all is passed" do bundle! "update --all" expect(deprecations).to be_empty @@ -251,13 +222,11 @@ RSpec.describe "major deprecations" do G end - it "should print no deprecations", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "should output a deprecation warning", :bundler => "2" do expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs`") end + + pending "fails with a helpful error", :bundler => "3" end context "bundle install with both gems.rb and Gemfile present" do @@ -271,7 +240,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to be_empty end - it "should print a proper warning, and use Gemfile", :bundler => "< 2" do + it "should print a proper warning, and use Gemfile", :bundler => "2" do create_file "gems.rb" install_gemfile! <<-G source "file://#{gem_repo1}" @@ -285,7 +254,7 @@ RSpec.describe "major deprecations" do expect(the_bundle).to include_gem "rack 1.0" end - it "should print a proper warning, and use gems.rb", :bundler => "2" do + it "should print a proper warning, and use gems.rb", :bundler => "3" do create_file "gems.rb" install_gemfile! <<-G source "file://#{gem_repo1}" @@ -302,7 +271,9 @@ RSpec.describe "major deprecations" do context "bundle install with flags" do before do - install_gemfile <<-G, :path => "vendor/bundle" + bundle "config set --local path vendor/bundle" + + install_gemfile <<-G source "file://#{gem_repo1}" gem "rack" G @@ -322,10 +293,13 @@ RSpec.describe "major deprecations" do }.each do |name, value| flag_name = "--#{name}" - context "with the #{flag_name} flag", :bundler => "2" do - it "should print a deprecation warning" do + context "with the #{flag_name} flag" do + before do + bundle "install" # to create a lockfile, which deployment or frozen need bundle "install #{flag_name} #{value}" + end + 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 accross bundler invokations, which bundler " \ @@ -333,14 +307,8 @@ RSpec.describe "major deprecations" do "`bundle config #{name} '#{value}'`, and stop using this flag" ) end - end - - context "with the #{flag_name} flag", :bundler => "< 2" do - it "should not print a deprecation warning" do - bundle "install #{flag_name} #{value}" - expect(deprecations).to be_empty - end + pending "should fail with a helpful error", :bundler => "3" end end end @@ -353,10 +321,6 @@ RSpec.describe "major deprecations" do G end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "shows a deprecation", :bundler => "2" do expect(deprecations).to include( "Your Gemfile contains multiple primary sources. " \ @@ -367,6 +331,8 @@ RSpec.describe "major deprecations" do "disable_multisource true`." ) end + + pending "should fail with a helpful error", :bundler => "3" end context "when Bundler.setup is run in a ruby script" do @@ -388,13 +354,13 @@ RSpec.describe "major deprecations" do RUBY end - it "should print a single deprecation warning", :bundler => "< 2" do + it "should print a single deprecation warning", :bundler => "< 3" do expect(warnings).to include( "Multiple gemfiles (gems.rb and Gemfile) detected. The gems.rb and gems.rb.locked files are currently ignored, but they will get used as soon as you delete your Gemfile and Gemfile.lock files." ) end - it "should print a single deprecation warning", :bundler => "2" do + it "should print a single deprecation warning", :bundler => "3" do expect(warnings).to include( "Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked." ) @@ -408,16 +374,14 @@ RSpec.describe "major deprecations" do RUBY end - it "should not print a capistrano deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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 "should fail with a helpful error", :bundler => "3" end describe Bundler::Dsl do @@ -449,14 +413,6 @@ The :github git source is deprecated, and will be removed in the future. Change github_uri = "https://github.com/indirect/sparks.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end - - it "upgrades to https on request", :bundler => "< 2" do - Bundler.settings.temporary "github.https" => true - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) - subject.gem("sparks", :github => "indirect/sparks") - github_uri = "https://github.com/indirect/sparks.git" - expect(subject.dependencies.first.source.uri).to eq(github_uri) - end end context "with bitbucket gems" do @@ -505,13 +461,11 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle! :show end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do expect(deprecations).to include("use `bundle list` instead of `bundle show`") end + + pending "fails with a helpful message", :bundler => "3" end context "with --outdated flag" do @@ -519,13 +473,11 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle! "show --outdated" end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - 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" end context "with --verbose flag" do @@ -533,13 +485,11 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle! "show --verbose" end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "prints a deprecation warning informing about its removal", :bundler => "2" do expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement") end + + pending "fails with a helpful message", :bundler => "3" end context "with a gem argument" do @@ -547,14 +497,12 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle! "show rack" end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "prints a deprecation warning recommending `bundle info`", :bundler => "2" do expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`") end end + + pending "fails with a helpful message", :bundler => "3" end context "bundle console" do @@ -562,14 +510,12 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "console" end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "prints a deprecation warning", :bundler => "2" do expect(deprecations).to include \ "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" end + + pending "fails with a helpful message", :bundler => "3" end context "bundle viz" do @@ -584,12 +530,10 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "viz" end - it "does not print a deprecation warning", :bundler => "< 2" do - expect(deprecations).to be_empty - end - it "prints a deprecation warning", :bundler => "2" do expect(deprecations).to include "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz" end + + pending "fails with a helpful message", :bundler => "3" end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 8ec5e3d999..9c62904286 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do context "without flags" do let(:bundle_platform_platforms_string) do platforms = [rb] - platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode? + platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_3_mode? platforms.map {|pl| "* #{pl}" }.join("\n") end @@ -633,7 +633,7 @@ G end end - it "fails if ruby version doesn't match", :bundler => "< 2" do + it "fails if ruby version doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rails" @@ -645,7 +645,7 @@ G should_be_ruby_version_incorrect end - it "fails if engine doesn't match", :bundler => "< 2" do + it "fails if engine doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rails" @@ -657,7 +657,7 @@ G should_be_engine_incorrect end - it "fails if engine version doesn't match", :bundler => "< 2" do + it "fails if engine version doesn't match", :bundler => "< 3" do simulate_ruby_engine "jruby" do gemfile <<-G source "file://#{gem_repo1}" @@ -671,7 +671,7 @@ G end end - it "fails when patchlevel doesn't match", :bundler => "< 2" do + it "fails when patchlevel doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -928,7 +928,7 @@ G end end - context "bundle console", :bundler => "< 2" do + context "bundle console", :bundler => "< 3" do before do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb index 4b410c3035..bc076c06bf 100644 --- a/spec/plugins/source/example_spec.rb +++ b/spec/plugins/source/example_spec.rb @@ -67,7 +67,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("a-path-gem 1.0") end - it "writes to lock file", :bundler => "< 2" do + it "writes to lock file", :bundler => "< 3" do bundle "install" lockfile_should_be <<-G @@ -92,7 +92,7 @@ RSpec.describe "real source plugins" do G end - it "writes to lock file", :bundler => "2" do + it "writes to lock file", :bundler => "3" do bundle "install" lockfile_should_be <<-G @@ -359,7 +359,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("ma-gitp-gem 1.0") end - it "writes to lock file", :bundler => "< 2" do + it "writes to lock file", :bundler => "< 3" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" @@ -386,7 +386,7 @@ RSpec.describe "real source plugins" do G end - it "writes to lock file", :bundler => "2" do + it "writes to lock file", :bundler => "3" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 22d94bef90..a3662c91e7 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -23,12 +23,12 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do gemfile <<-G source "https://rubygems.org" - gem 'rails', '~> 3.0' + gem 'rails', '~> 5.0' gem 'capybara', '~> 2.2.0' gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9 G bundle! :lock - expect(lockfile).to include(rubygems_version("rails", "~> 3.0")) + expect(lockfile).to include(rubygems_version("rails", "~> 5.0")) expect(lockfile).to include("capybara (2.2.1)") end @@ -37,7 +37,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do source "https://rubygems.org" gem "sass-rails" - gem "rails", "~> 3" + gem "rails", "~> 5" gem "gxapi_rails", "< 0.1.0" # 0.1.0 was released way after the test was written gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9 G @@ -150,7 +150,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do activemodel (= 4.2.7.1) activerecord (= 4.2.7.1) activesupport (= 4.2.7.1) - bundler (>= 1.3.0, < 2.0) + bundler (>= 1.3.0, < 3.0) railties (= 4.2.7.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb index dcee234e15..b2d5b6c03f 100644 --- a/spec/runtime/executable_spec.rb +++ b/spec/runtime/executable_spec.rb @@ -99,7 +99,7 @@ RSpec.describe "Running bin/* commands" do expect(bundled_app("bin/rackup")).not_to exist end - it "allows you to stop installing binstubs", :bundler => "< 2" do + it "allows you to stop installing binstubs", :bundler => "< 3" do bundle! "install --binstubs bin/" bundled_app("bin/rackup").rmtree bundle! "install --binstubs \"\"" @@ -110,7 +110,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 => "< 2" do + it "remembers that the option was specified", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "activesupport" @@ -129,23 +129,6 @@ RSpec.describe "Running bin/* commands" do expect(bundled_app("bin/rackup")).to exist end - it "rewrites bins on --binstubs (to maintain backwards compatibility)", :bundler => "< 2" do - gemfile <<-G - source "file://#{gem_repo1}" - gem "rack" - G - - bundle! :install, forgotten_command_line_options([:binstubs, :bin] => "bin") - - File.open(bundled_app("bin/rackup"), "wb") do |file| - file.print "OMG" - end - - bundle "install" - - expect(bundled_app("bin/rackup").read).to_not eq("OMG") - end - it "rewrites bins on binstubs (to maintain backwards compatibility)" do install_gemfile! <<-G source "file://#{gem_repo1}" diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index ac8170d2e1..c81baa34ea 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1327,7 +1327,7 @@ end end describe "after setup" do - it "allows calling #gem on random objects", :bundler => "< 2" do + it "allows calling #gem on random objects", :bundler => "< 3" do install_gemfile <<-G source "file:#{gem_repo1}" gem "rack" @@ -1342,7 +1342,7 @@ end expect(out).to eq("rack-1.0.0") end - it "keeps Kernel#gem private", :bundler => "2" do + it "keeps Kernel#gem private", :bundler => "3" do install_gemfile! <<-G source "file:#{gem_repo1}" gem "rack" diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb index 24a08992b2..b4503cba32 100644 --- a/spec/runtime/with_unbundled_env_spec.rb +++ b/spec/runtime/with_unbundled_env_spec.rb @@ -98,7 +98,7 @@ RSpec.describe "Bundler.with_env helpers" do it_behaves_like "an unbundling helper" end - describe "Bundler.clean_env" do + describe "Bundler.clean_env", :bundler => 2 do let(:modified_env) { "Bundler.clean_env" } it_behaves_like "an unbundling helper" @@ -120,7 +120,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.with_clean_env" do + describe "Bundler.with_clean_env", :bundler => 2 do it "should set ENV to unbundled_env in the block" do expected = Bundler.unbundled_env actual = Bundler.with_clean_env { ENV.to_hash } @@ -161,7 +161,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_system" do + describe "Bundler.clean_system", :bundler => 2 do it "runs system inside with_clean_env" do code = 'exit Bundler.clean_system(%(test "\$BUNDLE_FOO" = "bar"))' lib = File.expand_path("../../lib", __dir__) @@ -199,7 +199,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_exec" do + describe "Bundler.clean_exec", :bundler => 2 do let(:code) do <<~RUBY Process.fork do diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 7a78cee670..6470b57fb8 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -156,7 +156,7 @@ module Spec bang :bundle def forgotten_command_line_options(options) - remembered = Bundler::VERSION.split(".", 2).first == "1" + remembered = Bundler::VERSION.split(".", 2).first == "2" options = options.map do |k, v| k = Array(k)[remembered ? 0 : -1] v = '""' if v && v.to_s.empty? diff --git a/spec/support/path.rb b/spec/support/path.rb index ae7a8c5bbe..dc4b3bb6eb 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -29,7 +29,7 @@ module Spec end def default_bundle_path(*path) - if Bundler::VERSION.split(".").first.to_i < 2 + if Bundler::VERSION.split(".").first.to_i < 3 system_gem_path(*path) else bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), Gem::ConfigMap[:ruby_version], *path].compact) diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index 29758e888c..0a9e4a8cb6 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -105,7 +105,7 @@ module Spec end def local_platforms - if Bundler::VERSION.split(".").first.to_i > 1 + if Bundler::VERSION.split(".").first.to_i > 2 [local, specific_local_platform] else [local] diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index 1d5bce2758..4fe22269e2 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -299,7 +299,7 @@ RSpec.describe "bundle update" do G end - it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "< 2" do + it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "< 3" do spec_lines = lib_path("bar/foo.gemspec").read.split("\n") spec_lines[5] = "s.version = '2.0'" @@ -335,7 +335,7 @@ RSpec.describe "bundle update" do G end - it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "2" do + it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "3" do spec_lines = lib_path("bar/foo.gemspec").read.split("\n") spec_lines[5] = "s.version = '2.0'" diff --git a/spec/update/redownload_spec.rb b/spec/update/redownload_spec.rb index b70c009248..39edac0902 100644 --- a/spec/update/redownload_spec.rb +++ b/spec/update/redownload_spec.rb @@ -18,16 +18,6 @@ RSpec.describe "bundle update" do bundle! "update rack --no-color --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end - - it "does not show a deprecation when single flag passed", :bundler => "< 2" do - bundle! "update rack --force" - expect(out).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" - end - - it "does not show a deprecation when multiple flags passed", :bundler => "< 2" do - bundle! "update rack --no-color --force" - expect(out).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" - end end describe "with --redownload" do |