diff options
Diffstat (limited to 'spec/other/major_deprecation_spec.rb')
-rw-r--r-- | spec/other/major_deprecation_spec.rb | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index ef51112d72..445c970c4c 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true -RSpec.describe "major deprecations", :bundler => "< 2" do - let(:warnings) { last_command.bundler_err } # change to err in 2.0 - let(:warnings_without_version_messages) { warnings.gsub(/#{Spec::Matchers::MAJOR_DEPRECATION}Bundler will only support ruby >= .*/, "") } +RSpec.describe "major deprecations" do + let(:warnings) { err } before do create_file "gems.rb", <<-G @@ -35,29 +34,33 @@ RSpec.describe "major deprecations", :bundler => "< 2" do describe "bundle update --quiet" do it "does not print any deprecations" do bundle :update, :quiet => true - expect(warnings_without_version_messages).not_to have_major_deprecation + expect(warnings).not_to have_major_deprecation end end describe "bundle update" do before do - create_file("gems.rb", "") bundle! "install" end - it "warns when no options are given" do + it "does not warn when no options are given", :bundler => "< 2" do + bundle! "update" + expect(warnings).not_to have_major_deprecation + end + + it "warns when no options are given", :bundler => "2" do bundle! "update" expect(warnings).to have_major_deprecation a_string_including("Pass --all to `bundle update` to update everything") end it "does not warn when --all is passed" do bundle! "update --all" - expect(warnings_without_version_messages).not_to have_major_deprecation + expect(warnings).not_to have_major_deprecation end end describe "bundle install --binstubs" do - it "should output a deprecation warning" do + xit "should output a deprecation warning" do gemfile <<-G gem 'rack' G @@ -76,10 +79,10 @@ RSpec.describe "major deprecations", :bundler => "< 2" do G bundle :install - expect(warnings_without_version_messages).not_to have_major_deprecation + expect(warnings).not_to have_major_deprecation end - it "should print a Gemfile deprecation warning" do + xit "should print a Gemfile deprecation warning" do create_file "gems.rb" install_gemfile! <<-G source "file://#{gem_repo1}" @@ -91,7 +94,7 @@ RSpec.describe "major deprecations", :bundler => "< 2" do end context "with flags" do - it "should print a deprecation warning about autoremembering flags" do + xit "should print a deprecation warning about autoremembering flags" do install_gemfile <<-G, :path => "vendor/bundle" source "file://#{gem_repo1}" gem "rack" @@ -122,7 +125,7 @@ RSpec.describe "major deprecations", :bundler => "< 2" do Bundler.setup RUBY - expect(warnings_without_version_messages).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.") + expect(warnings).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.") end end @@ -139,7 +142,7 @@ RSpec.describe "major deprecations", :bundler => "< 2" do end end - describe Bundler::Dsl do + xdescribe Bundler::Dsl do before do @rubygems = double("rubygems") allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems } @@ -205,24 +208,34 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add end context "bundle show" do - it "prints a deprecation warning" do + before do install_gemfile! <<-G source "file://#{gem_repo1}" gem "rack" G bundle! :show + end - warnings.gsub!(/gems included.*?\[DEPRECATED/im, "[DEPRECATED") + it "does not print a deprecation warning", :bundler => "< 2" do + expect(warnings).not_to have_major_deprecation + end + it "prints a deprecation warning", :bundler => "2" do expect(warnings).to have_major_deprecation a_string_including("use `bundle list` instead of `bundle show`") end end context "bundle console" do - it "prints a deprecation warning" do + before do bundle "console" + end + + it "does not print a deprecation warning", :bundler => "< 2" do + expect(warnings).not_to have_major_deprecation + end + it "prints a deprecation warning", :bundler => "2" do expect(warnings).to have_major_deprecation \ a_string_including("bundle console will be replaced by `bin/console` generated by `bundle gem <name>`") end |