From e8c08b0cee32e7229a3a27c5326b4ec7332211f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 21 Mar 2019 12:35:16 +0100 Subject: Prefer the standard `install_gemfile!` --- spec/other/major_deprecation_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 3d79a51b94..7047235dd3 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -5,12 +5,11 @@ RSpec.describe "major deprecations" do describe "Bundler" do before do - create_file "gems.rb", <<-G + install_gemfile! <<-G source "file:#{gem_repo1}" ruby #{RUBY_VERSION.dump} gem "rack" G - bundle! "install" end describe ".clean_env" do -- cgit v1.2.1 From 1db65c45d2552b452087209a59471ae9d8611aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 21 Mar 2019 12:37:48 +0100 Subject: Remove unnecessary Gemfile line --- spec/other/major_deprecation_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 7047235dd3..e67c524206 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -7,7 +7,6 @@ RSpec.describe "major deprecations" do before do install_gemfile! <<-G source "file:#{gem_repo1}" - ruby #{RUBY_VERSION.dump} gem "rack" G end -- cgit v1.2.1 From 3494269b35a9d9d6580eb978663d6156c297bf4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 21 Mar 2019 12:38:13 +0100 Subject: Fix major deprecation specs nesting They not all need to create & install a Gemfile, so let's do only what's needed. Also the spec descriptions are simpler when no so deeply nested. --- spec/other/major_deprecation_spec.rb | 224 ++++++++++++++++++----------------- 1 file changed, 115 insertions(+), 109 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index e67c524206..503ba5784a 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -96,164 +96,170 @@ RSpec.describe "major deprecations" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load" end end + end - describe "bundle update --quiet" do - it "does not print any deprecations" do - bundle :update, :quiet => true - expect(deprecations).to be_empty - end + describe "bundle update --quiet" do + it "does not print any deprecations" do + bundle :update, :quiet => true + expect(deprecations).to be_empty end + end - describe "bundle config" do - describe "old list interface" do - before 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 + describe "bundle config" do + describe "old list interface" do + before do + bundle! "config" end - describe "old get interface" do - before 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 + it "does not warn", :bundler => "< 2" do + expect(deprecations).to be_empty end - describe "old set interface" do - before 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 + 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 + end - describe "old set interface with --local" do - before 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 + describe "old get interface" do + before do + bundle! "config waka" end - describe "old set interface with --global" do - before do - bundle! "config --global waka wakapun" - end - - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - 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 + 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 + end - describe "old unset interface" do - before do - bundle! "config --delete waka" - end + describe "old set interface" do + before do + bundle! "config waka wakapun" + end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - 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 + 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 + end - describe "old unset interface with --local" do - before do - bundle! "config --delete --local waka" - end + describe "old set interface with --local" do + before do + bundle! "config --local waka wakapun" + end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - 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 + 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 + end - describe "old unset interface with --global" do - before do - bundle! "config --delete --global waka" - end + describe "old set interface with --global" do + before do + bundle! "config --global waka wakapun" + end - it "does not warn", :bundler => "< 2" do - expect(deprecations).to be_empty - 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 + 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 end - describe "bundle update" do + describe "old unset interface" do before do - bundle! "install" + bundle! "config --delete waka" end - it "does not warn when no options are given", :bundler => "< 2" do - bundle! "update" + it "does not warn", :bundler => "< 2" do 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") + 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 + end + + describe "old unset interface with --local" do + before do + bundle! "config --delete --local waka" end - it "does not warn when --all is passed" do - bundle! "update --all" + 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 end - describe "bundle install --binstubs" do + describe "old unset interface with --global" do before do - bundle :install, :binstubs => true + bundle! "config --delete --global waka" end - it "should print no deprecations", :bundler => "< 2" do + it "does not warn", :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`") + 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 end end + describe "bundle update" do + before do + install_gemfile <<-G + source "file:#{gem_repo1}" + gem "rack" + 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 + + it "does not warn when --all is passed" do + bundle! "update --all" + expect(deprecations).to be_empty + end + end + + describe "bundle install --binstubs" do + before do + install_gemfile <<-G, :binstubs => true + source "file:#{gem_repo1}" + gem "rack" + 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 + end + context "when bundle install is run" do it "should not warn about gems.rb" do create_file "gems.rb", <<-G -- cgit v1.2.1 From 143f87e9104cfcfe4fb90c80c7171bdbdb2ec038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 21 Mar 2019 12:40:39 +0100 Subject: Simplify some spec descriptions --- spec/other/major_deprecation_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 503ba5784a..9c5228b5c3 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -260,7 +260,7 @@ RSpec.describe "major deprecations" do end end - context "when bundle install is run" do + context "bundle install with both gems.rb and Gemfile present" do it "should not warn about gems.rb" do create_file "gems.rb", <<-G source "file://#{gem_repo1}" @@ -271,7 +271,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to be_empty end - it "should print a proper warning when both gems.rb and Gemfile present, 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 +285,7 @@ RSpec.describe "major deprecations" do expect(the_bundle).to include_gem "rack 1.0" end - it "should print a proper warning when both gems.rb and Gemfile present, and use gems.rb", :bundler => "2" do + it "should print a proper warning, and use gems.rb", :bundler => "2" do create_file "gems.rb" install_gemfile! <<-G source "file://#{gem_repo1}" -- cgit v1.2.1 From 4ca104a6533e0c0599f34180c6ab35fa8c9015a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 21 Mar 2019 12:46:12 +0100 Subject: Remove one more nesting level For consistency with other specs. --- spec/other/major_deprecation_spec.rb | 76 ++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 9c5228b5c3..d041fd13bd 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -298,48 +298,48 @@ RSpec.describe "major deprecations" do expect(the_bundle).not_to include_gem "rack 1.0" end + end - context "with flags" do - before do - install_gemfile <<-G, :path => "vendor/bundle" - source "file://#{gem_repo1}" - gem "rack" - G - end - - { - :clean => true, - :deployment => true, - :frozen => true, - :"no-cache" => true, - :"no-prune" => true, - :path => "vendor/bundle", - :shebang => "ruby27", - :system => true, - :without => "development", - :with => "development", - }.each do |name, value| - flag_name = "--#{name}" - - context "with the #{flag_name} flag", :bundler => "2" do - it "should print a deprecation warning" do - bundle "install #{flag_name} #{value}" - - expect(deprecations).to include( - "The `#{flag_name}` flag is deprecated because it relies on " \ - "being remembered accross bundler invokations, which bundler " \ - "will no longer do in future versions. Instead please use " \ - "`bundle config #{name} '#{value}'`, and stop using this flag" - ) - end + context "bundle install with flags" do + before do + install_gemfile <<-G, :path => "vendor/bundle" + source "file://#{gem_repo1}" + gem "rack" + G + end + + { + :clean => true, + :deployment => true, + :frozen => true, + :"no-cache" => true, + :"no-prune" => true, + :path => "vendor/bundle", + :shebang => "ruby27", + :system => true, + :without => "development", + :with => "development", + }.each do |name, value| + flag_name = "--#{name}" + + context "with the #{flag_name} flag", :bundler => "2" do + it "should print a deprecation warning" do + bundle "install #{flag_name} #{value}" + + expect(deprecations).to include( + "The `#{flag_name}` flag is deprecated because it relies on " \ + "being remembered accross bundler invokations, which bundler " \ + "will no longer do in future versions. Instead please use " \ + "`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}" + 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 + expect(deprecations).to be_empty end end end -- cgit v1.2.1