ruby-changes:61514
From: David <ko1@a...>
Date: Fri, 5 Jun 2020 07:33:44 +0900 (JST)
Subject: [ruby-changes:61514] e413e746af (master): [rubygems/rubygems] Remove `forgotten_command_line_usages` from specs
https://git.ruby-lang.org/ruby.git/commit/?id=e413e746af From e413e746afd20a7a0629c3e3c572d6d3dffc1c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 29 May 2020 12:46:16 +0200 Subject: [rubygems/rubygems] Remove `forgotten_command_line_usages` from specs Instead, use the non-deprecated option except when specifically testing deprecated CLI flags. In that case, pass the flag directly and limit the specs to `bundler < 3`. https://github.com/rubygems/rubygems/commit/3d5e186241 diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index 09a1b84..3370944 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -221,7 +221,8 @@ RSpec.describe "bundle cache" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/cache_spec.rb#L221 end end - install_gemfile! <<-G, forgotten_command_line_options(:without => "wo") + bundle "config --local without wo" + install_gemfile! <<-G source "file:#{gem_repo1}" gem "rack" group :wo do @@ -236,7 +237,8 @@ RSpec.describe "bundle cache" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/cache_spec.rb#L237 expect(the_bundle).to include_gem "rack 1.0" expect(the_bundle).not_to include_gems "weakling", "uninstallable" - bundle! :install, forgotten_command_line_options(:without => "wo") + bundle "config --local without wo" + bundle! :install expect(the_bundle).to include_gem "rack 1.0" expect(the_bundle).not_to include_gems "weakling", "uninstallable" end @@ -251,7 +253,10 @@ RSpec.describe "bundle cache" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/cache_spec.rb#L253 bundle "install" end - subject { bundle :cache, forgotten_command_line_options(:frozen => true) } + subject do + bundle "config --local frozen true" + bundle :cache + end it "tries to install with frozen" do bundle! "config set deployment true" @@ -299,7 +304,9 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/cache_spec.rb#L304 simulate_new_machine FileUtils.rm_rf gem_repo2 - bundle! :install, forgotten_command_line_options(:deployment => true, :path => "vendor/bundle") + bundle "config --local deployment true" + bundle "config --local path vendor/bundle" + bundle! :install expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index 8955e51..c7f887d 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -123,7 +123,8 @@ RSpec.describe "bundle check" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/check_spec.rb#L123 gem "rack", :group => :foo G - bundle :install, forgotten_command_line_options(:without => "foo") + bundle "config --local without foo" + bundle :install gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -230,7 +231,8 @@ RSpec.describe "bundle check" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/check_spec.rb#L231 gem "foo" G - bundle! "install", forgotten_command_line_options(:deployment => true) + bundle "config --local deployment true" + bundle! "install" FileUtils.rm(bundled_app_lock) bundle :check diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index 3a6b72d..898622a 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -45,7 +45,8 @@ RSpec.describe ".bundle/config" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/config_spec.rb#L45 it "can be moved with an environment variable" do ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s - bundle "install", forgotten_command_line_options(:path => "vendor/bundle") + bundle "config --local path vendor/bundle" + bundle "install" expect(bundled_app(".bundle")).not_to exist expect(tmp("foo/bar/config")).to exist @@ -56,7 +57,8 @@ RSpec.describe ".bundle/config" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/config_spec.rb#L57 FileUtils.mkdir_p bundled_app("omg") ENV["BUNDLE_APP_CONFIG"] = "../foo" - bundle "install", forgotten_command_line_options(:path => "vendor/bundle").merge(:dir => bundled_app("omg")) + bundle "config --local path vendor/bundle" + bundle "install", :dir => bundled_app("omg") expect(bundled_app(".bundle")).not_to exist expect(bundled_app("../foo/config")).to exist diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 1b1839a..0c899b9 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -270,7 +270,8 @@ RSpec.describe "bundle exec" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/exec_spec.rb#L270 end it "handles gems installed with --without", :ruby_repo do - install_gemfile <<-G, forgotten_command_line_options(:without => "middleware") + bundle "config --local without middleware" + install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" # rack 0.9.1 and 1.0 exist diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index d8f8355..881b5e8 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -273,7 +273,8 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L273 end it "works" do - bundle "install", forgotten_command_line_options(:path => "vendor") + bundle "config --local path vendor" + bundle "install" expect(the_bundle).to include_gems "rack 1.0" end @@ -549,7 +550,8 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L550 it "should display a proper message to explain the problem" do FileUtils.chmod(0o500, bundled_app("vendor")) - bundle :install, forgotten_command_line_options(:path => "vendor") + bundle "config --local path vendor" + bundle :install expect(err).to include(bundled_app("vendor").to_s) expect(err).to include("grant write permissions") end @@ -561,7 +563,7 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L563 source "#{file_uri_for(gem_repo1)}" gem "rack" G - forgotten_command_line_options(:path => "bundle") + bundle "config --local path bundle" bundle! "install", :standalone => true end diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index bcbf367..5c61127 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -29,19 +29,22 @@ RSpec.describe "post bundle message" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/post_bundle_message_spec.rb#L29 expect(out).to include(bundle_complete_message) expect(out).to include(installed_gems_stats) - bundle! :install, forgotten_command_line_options(:without => "emo") + bundle "config --local without emo" + bundle! :install expect(out).to include(bundle_show_message) expect(out).to include("Gems in the group emo were not installed") expect(out).to include(bundle_complete_message) expect(out).to include(installed_gems_stats) - bundle! :install, forgotten_command_line_options(:without => "emo test") + bundle "config --local without emo test" + bundle! :install expect(out).to include(bundle_show_message) expect(out).to include("Gems in the groups emo and test were not installed") expect(out).to include(bundle_complete_message) expect(out).to include("4 Gemfile dependencies, 3 gems now installed.") - bundle! :install, forgotten_command_line_options(:without => "emo obama test") + bundle "config --local without emo obama test" + bundle! :install expect(out).to include(bundle_show_message) expect(out).to include("Gems in the groups emo, obama and test were not installed") expect(out).to include(bundle_complete_message) @@ -52,22 +55,29 @@ RSpec.describe "post bundle message" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/post_bundle_message_spec.rb#L55 let(:bundle_path) { "./vendor" } it "shows proper messages according to the configured groups" do - bundle! :install, forgotten_command_line_options(:path => "vendor") + bundle "config --local path vendor" + bundle! :install expect(out).to include(bundle_show_path_message) expect(out).to_not include("Gems in the group") expect(out).to include(bundle_complete_message) - bundle! :install, forgotten_command_line_options(:without => "emo", :path => "vendor") + bundle "config --local path vendor" + bundle "config --local without emo" + bundle! :install expect(out).to include(bundle_show_path_message) expect(out).to include("Gems in the group emo were not installed") expect(out).to include(bundle_complete_message) - bundle! :install, forgotten_command_line_options(:without => "emo test", :path => "vendor") + bundle "config --local path vendor" + bundle "config --local without emo test" + bundle! :install expect(out).to include(bundle_show_path_message) expect(out).to include("Gems in the groups emo and test were not installed") expect(out).to include(bundl (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/