diff options
Diffstat (limited to 'spec/bundler/other')
-rw-r--r-- | spec/bundler/other/cli_dispatch_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/other/major_deprecation_spec.rb | 58 |
2 files changed, 43 insertions, 23 deletions
diff --git a/spec/bundler/other/cli_dispatch_spec.rb b/spec/bundler/other/cli_dispatch_spec.rb index 67127fc6e0..548539ac89 100644 --- a/spec/bundler/other/cli_dispatch_spec.rb +++ b/spec/bundler/other/cli_dispatch_spec.rb @@ -3,19 +3,19 @@ RSpec.describe "bundle command names" do it "work when given fully" do bundle "install" - expect(last_command.bundler_err).to eq("Could not locate Gemfile") + expect(err).to eq("Could not locate Gemfile") expect(last_command.stdboth).not_to include("Ambiguous command") end it "work when not ambiguous" do bundle "ins" - expect(last_command.bundler_err).to eq("Could not locate Gemfile") + expect(err).to eq("Could not locate Gemfile") expect(last_command.stdboth).not_to include("Ambiguous command") end it "print a friendly error when ambiguous" do bundle "in" - expect(last_command.bundler_err).to eq("Ambiguous command in matches [info, init, inject, install]") + expect(err).to eq("Ambiguous command in matches [info, init, inject, install]") end context "when cache_command_is_package is set" do @@ -23,7 +23,7 @@ RSpec.describe "bundle command names" do it "dispatches `bundle cache` to the package command" do bundle "cache --verbose" - expect(last_command.stdout).to start_with "Running `bundle package --verbose`" + expect(out).to start_with "Running `bundle package --verbose`" end end end diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 83944e4075..fd12c645a8 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -365,38 +365,30 @@ RSpec.describe "major deprecations" do end describe Bundler::Dsl do - let(:msg) do - <<-EOS -The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: - - git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } - - EOS - end - before do @rubygems = double("rubygems") allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems } end context "with github gems" do - it "warns about the https change if people are opting out" do - Bundler.settings.temporary "github.https" => false - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "Setting `github.https` to false is deprecated and won't be supported in the future.") - subject.gem("sparks", :github => "indirect/sparks") - end + it "warns about removal", :bundler => "2" do + msg = <<-EOS +The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: - it "upgrades to https by default", :bundler => "2" do + git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } + + EOS 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 + + pending "should fail with a helpful error", :bundler => "3" end context "with bitbucket gems" do - it "warns about removal" do + it "warns about removal", :bundler => "2" do allow(Bundler.ui).to receive(:deprecate) msg = <<-EOS The :bitbucket git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work: @@ -411,10 +403,12 @@ The :bitbucket git source is deprecated, and will be removed in the future. Add expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") end + + pending "should fail with a helpful error", :bundler => "3" end context "with gist gems" do - it "warns about removal" do + it "warns about removal", :bundler => "2" do allow(Bundler.ui).to receive(:deprecate) msg = <<-EOS The :gist git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work: @@ -425,6 +419,8 @@ The :gist git source is deprecated, and will be removed in the future. Add this expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :gist => "1234") end + + pending "should fail with a helpful error", :bundler => "3" end end @@ -480,9 +476,33 @@ The :gist git source is deprecated, and will be removed in the future. Add this 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 + + pending "fails with a helpful message", :bundler => "3" + end + + context "with the --paths option" do + before do + bundle "show --paths" + end + + it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do + expect(deprecations).to include("use `bundle list` instead of `bundle show --paths`") + end + + pending "fails with a helpful message", :bundler => "3" end - pending "fails with a helpful message", :bundler => "3" + context "with a gem argument and the --paths option" do + before do + bundle "show rack --paths" + end + + it "prints deprecation warning recommending `bundle info`", :bundler => "2" do + expect(deprecations).to include("use `bundle info rack --path` instead of `bundle show rack --paths`") + end + + pending "fails with a helpful message", :bundler => "3" + end end context "bundle console" do |