From 2fafc08aa34ddba39d0bfdb6e7c5de4f7bf7f55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 24 Jun 2020 19:53:16 +0200 Subject: [rubygems/rubygems] Remove unneeded trailing conditions on exitstatus https://github.com/rubygems/rubygems/commit/27e0e4ecb6 --- spec/bundler/bundler/cli_spec.rb | 4 ++-- spec/bundler/cache/gems_spec.rb | 2 +- spec/bundler/commands/binstubs_spec.rb | 18 +++++++++--------- spec/bundler/commands/cache_spec.rb | 2 +- spec/bundler/commands/check_spec.rb | 10 +++++----- spec/bundler/commands/clean_spec.rb | 2 +- spec/bundler/commands/exec_spec.rb | 8 ++++---- spec/bundler/commands/install_spec.rb | 4 ++-- spec/bundler/commands/newgem_spec.rb | 2 +- spec/bundler/commands/outdated_spec.rb | 4 ++-- spec/bundler/commands/update_spec.rb | 2 +- spec/bundler/install/deploy_spec.rb | 4 ++-- spec/bundler/install/gemfile/git_spec.rb | 2 +- spec/bundler/install/gemfile/path_spec.rb | 2 +- spec/bundler/install/gemfile/sources_spec.rb | 8 ++++---- spec/bundler/install/gems/compact_index_spec.rb | 6 +++--- spec/bundler/install/gemspecs_spec.rb | 4 ++-- spec/bundler/install/path_spec.rb | 2 +- spec/bundler/other/platform_spec.rb | 16 ++++++++-------- spec/bundler/plugins/install_spec.rb | 2 +- 20 files changed, 52 insertions(+), 52 deletions(-) (limited to 'spec/bundler') diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index 8ccae17fe0..50e2a698eb 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -5,12 +5,12 @@ require "bundler/cli" RSpec.describe "bundle executable" do it "returns non-zero exit status when passed unrecognized options" do bundle "--invalid_argument", :raise_on_error => false - expect(exitstatus).to_not be_zero if exitstatus + expect(exitstatus).to_not be_zero end it "returns non-zero exit status when passed unrecognized task" do bundle "unrecognized-task", :raise_on_error => false - expect(exitstatus).to_not be_zero if exitstatus + expect(exitstatus).to_not be_zero end it "looks for a binary and executes it if it's named bundler-" do diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb index 8d7470836d..2b5ba733f0 100644 --- a/spec/bundler/cache/gems_spec.rb +++ b/spec/bundler/cache/gems_spec.rb @@ -138,7 +138,7 @@ RSpec.describe "bundle cache" do G bundle :cache, :raise_on_error => false - expect(exitstatus).to_not eq(0) if exitstatus + expect(exitstatus).to_not eq(0) expect(err).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached") end end diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 2af5839a24..632c521caa 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -58,7 +58,7 @@ RSpec.describe "bundle binstubs " do G bundle "binstubs", :raise_on_error => false - expect(exitstatus).to eq(1) if exitstatus + expect(exitstatus).to eq(1) expect(err).to include("`bundle binstubs` needs at least one gem to run.") end @@ -123,7 +123,7 @@ RSpec.describe "bundle binstubs " do context "when BUNDLER_VERSION is set" do it "runs the correct version of bundler" do sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" }, :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") end @@ -137,7 +137,7 @@ RSpec.describe "bundle binstubs " do it "runs the correct version of bundler" do sys_exec "bin/bundle install", :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") end @@ -152,7 +152,7 @@ RSpec.describe "bundle binstubs " do it "runs the correct version of bundler" do sys_exec "bin/bundle install", :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") end @@ -167,7 +167,7 @@ RSpec.describe "bundle binstubs " do it "runs the available version of bundler when the version is older and the same major" do sys_exec "bin/bundle install" - expect(exitstatus).not_to eq(42) if exitstatus + expect(exitstatus).not_to eq(42) expect(err).not_to include("Activating bundler (~> 55.0) failed:") end end @@ -181,7 +181,7 @@ RSpec.describe "bundle binstubs " do it "runs the correct version of bundler when the version is a pre-release" do sys_exec "bin/bundle install", :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 2.12.a) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`") end @@ -198,7 +198,7 @@ RSpec.describe "bundle binstubs " do it "calls through to the explicit bundler version" do sys_exec "bin/bundle update --bundler=999.999.999", :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") end @@ -223,7 +223,7 @@ RSpec.describe "bundle binstubs " do it "attempts to load that version" do sys_exec bundled_app("bin/rackup").to_s, :raise_on_error => false - expect(exitstatus).to eq(42) if exitstatus + expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") end @@ -297,7 +297,7 @@ RSpec.describe "bundle binstubs " do bundle "binstubs doesnt_exist", :raise_on_error => false - expect(exitstatus).to eq(7) if exitstatus + expect(exitstatus).to eq(7) expect(err).to include("Could not find gem 'doesnt_exist'.") end end diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index cbad2cee47..173389c068 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -266,7 +266,7 @@ RSpec.describe "bundle cache" do gem "rack-obama" G subject - expect(exitstatus).to eq(16) if exitstatus + expect(exitstatus).to eq(16) expect(err).to include("deployment mode") expect(err).to include("You have added to the Gemfile") expect(err).to include("* rack-obama") diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index b2d459368e..dd69172677 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -66,7 +66,7 @@ RSpec.describe "bundle check" do G bundle :check, :raise_on_error => false - expect(exitstatus).to be > 0 if exitstatus + expect(exitstatus).to be > 0 expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -128,7 +128,7 @@ RSpec.describe "bundle check" do bundle "check", :raise_on_error => false expect(err).to include("* rack (1.0.0)") - expect(exitstatus).to eq(1) if exitstatus + expect(exitstatus).to eq(1) end it "ignores missing gems restricted to other platforms" do @@ -195,13 +195,13 @@ RSpec.describe "bundle check" do it "outputs an error when the default Gemfile is not found" do bundle :check, :raise_on_error => false - expect(exitstatus).to eq(10) if exitstatus + expect(exitstatus).to eq(10) expect(err).to include("Could not locate Gemfile") end it "does not output fatal error message" do bundle :check, :raise_on_error => false - expect(exitstatus).to eq(10) if exitstatus + expect(exitstatus).to eq(10) expect(err).not_to include("Unfortunately, a fatal error has occurred. ") end @@ -253,7 +253,7 @@ RSpec.describe "bundle check" do end it "returns false" do - expect(exitstatus).to eq(1) if exitstatus + expect(exitstatus).to eq(1) expect(err).to match(/The following gems are missing/) end end diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index d7124b398d..0ecdf230f9 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -327,7 +327,7 @@ RSpec.describe "bundle clean" do bundle :clean, :raise_on_error => false - expect(exitstatus).to eq(15) if exitstatus + expect(exitstatus).to eq(15) expect(err).to include("--force") end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index b38afb463d..fbce4b7bc1 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -327,7 +327,7 @@ RSpec.describe "bundle exec" do G bundle "exec foobarbaz", :raise_on_error => false - expect(exitstatus).to eq(127) if exitstatus + expect(exitstatus).to eq(127) expect(err).to include("bundler: command not found: foobarbaz") expect(err).to include("Install missing gem executables with `bundle install`") end @@ -339,7 +339,7 @@ RSpec.describe "bundle exec" do bundle "exec touch foo" bundle "exec ./foo", :raise_on_error => false - expect(exitstatus).to eq(126) if exitstatus + expect(exitstatus).to eq(126) expect(err).to include("bundler: not executable: ./foo") end @@ -349,7 +349,7 @@ RSpec.describe "bundle exec" do G bundle "exec", :raise_on_error => false - expect(exitstatus).to eq(128) if exitstatus + expect(exitstatus).to eq(128) expect(err).to include("bundler: exec needs a command to run") end @@ -647,7 +647,7 @@ RSpec.describe "bundle exec" do skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? subject - expect(exitstatus).to eq(exit_code) if exitstatus + expect(exitstatus).to eq(exit_code) expect(err).to eq(expected_err) expect(out).to eq(expected) end diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 833cf3e02f..98290bbc9e 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -119,7 +119,7 @@ RSpec.describe "bundle install with gem sources" do source "#{file_uri_for(gem_repo1)}" gem :rack G - expect(exitstatus).to eq(4) if exitstatus + expect(exitstatus).to eq(4) end it "pulls in dependencies" do @@ -578,7 +578,7 @@ RSpec.describe "bundle install with gem sources" do it "should display a helpful message explaining how to fix it" do bundle :install, :env => { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" }, :raise_on_error => false - expect(exitstatus).to eq(17) if exitstatus + expect(exitstatus).to eq(17) expect(err).to eq("Please CGI escape your usernames and passwords before " \ "setting them for authentication.") end diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 810d9a8f06..16ce9def37 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -1055,7 +1055,7 @@ Usage: "bundle gem NAME [OPTIONS]" FileUtils.touch(bundled_app("conflict-foobar")) bundle "gem conflict-foobar", :raise_on_error => false expect(err).to include("Errno::ENOTDIR") - expect(exitstatus).to eql(32) if exitstatus + expect(exitstatus).to eql(32) end end diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index 8518e49e82..2a07f1c784 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -68,7 +68,7 @@ RSpec.describe "bundle outdated" do bundle "outdated", :raise_on_error => false - expect(exitstatus).to_not be_zero if exitstatus + expect(exitstatus).to_not be_zero end it "returns success exit status if no outdated gems present" do @@ -517,7 +517,7 @@ RSpec.describe "bundle outdated" do it "returns non-zero exit code" do bundle "outdated invalid_gem_name", :raise_on_error => false - expect(exitstatus).to_not be_zero if exitstatus + expect(exitstatus).to_not be_zero end end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index bed2f6c86c..5ab932e5d7 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -701,7 +701,7 @@ RSpec.describe "bundle update" do bundle "update nonexisting", :raise_on_error => false expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.") - expect(exitstatus).to eq(22) if exitstatus + expect(exitstatus).to eq(22) end end diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 429041d9e9..357f4512f1 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -23,7 +23,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "install --deployment --system", :raise_on_error => false 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 + expect(exitstatus).to eq(15) end it "disallows --deployment --path --system" do @@ -31,7 +31,7 @@ RSpec.describe "install in deployment or frozen mode" do 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 + expect(exitstatus).to eq(15) end it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index aaef839c0a..c0e2510acd 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -926,7 +926,7 @@ RSpec.describe "bundle install with git sources" do gem "foo", :git => "#{lib_path("foo-1.0")}" G - expect(exitstatus).to_not eq(0) if exitstatus + expect(exitstatus).to_not eq(0) expect(err).to include("Bundler could not install a gem because it " \ "needs to create a directory, but a file exists " \ "- #{default_bundle_path("bundler")}") diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index 84ece3d699..07722d09dd 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -309,7 +309,7 @@ RSpec.describe "bundle install with explicit source paths" do gemspec :path => "#{lib_path("foo")}" G - expect(exitstatus).to eq(15) if exitstatus + expect(exitstatus).to eq(15) expect(err).to match(/There are multiple gemspecs/) end diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 3690dc50d6..be41857043 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -38,7 +38,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "fails", :bundler => "3" do bundle :instal, :raise_on_error => false expect(err).to include("Each source after the first must include a block") - expect(exitstatus).to eq(4) if exitstatus + expect(exitstatus).to eq(4) end end @@ -64,7 +64,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "fails", :bundler => "3" do bundle :install, :raise_on_error => false expect(err).to include("Each source after the first must include a block") - expect(exitstatus).to eq(4) if exitstatus + expect(exitstatus).to eq(4) end end end @@ -258,7 +258,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "fails", :bundler => "3" do bundle :install, :raise_on_error => false expect(err).to include("Each source after the first must include a block") - expect(exitstatus).to eq(4) if exitstatus + expect(exitstatus).to eq(4) end end @@ -298,7 +298,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "fails", :bundler => "3" do bundle :install, :raise_on_error => false expect(err).to include("Each source after the first must include a block") - expect(exitstatus).to eq(4) if exitstatus + expect(exitstatus).to eq(4) end end end diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 18c9485c3c..6e5177c60d 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -856,7 +856,7 @@ The checksum of /versions does not match the checksum provided by the server! So source "htps://rubygems.org" gem "rack" G - expect(exitstatus).to eq(15) if exitstatus + expect(exitstatus).to eq(15) expect(err).to end_with(<<-E.strip) The request uri `htps://index.rubygems.org/versions` has an invalid scheme (`htps`). Did you mean `http` or `https`? E @@ -869,7 +869,7 @@ The checksum of /versions does not match the checksum provided by the server! So gem "rack" G - expect(exitstatus).to eq(19) if exitstatus + expect(exitstatus).to eq(19) expect(err). to include("Bundler cannot continue installing rack (1.0.0)."). and include("The checksum for the downloaded `rack-1.0.0.gem` does not match the checksum given by the server."). @@ -888,7 +888,7 @@ The checksum of /versions does not match the checksum provided by the server! So source "#{source_uri}" gem "rack" G - expect(exitstatus).to eq(5) if exitstatus + expect(exitstatus).to eq(5) expect(err).to include("The given checksum for rack-1.0.0 (\"checksum!\") is not a valid SHA256 hexdigest nor base64digest") end diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb index 98e87f1b21..0db1f1985b 100644 --- a/spec/bundler/install/gemspecs_spec.rb +++ b/spec/bundler/install/gemspecs_spec.rb @@ -130,7 +130,7 @@ RSpec.describe "bundle install" do expect(err).to include("Ruby patchlevel") expect(err).to include("but your Gemfile specified") - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) end it "fails and complains about version on version mismatch" do @@ -147,7 +147,7 @@ RSpec.describe "bundle install" do expect(err).to include("Ruby version") expect(err).to include("but your Gemfile specified") - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) end end end diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb index 22eedad388..2239706020 100644 --- a/spec/bundler/install/path_spec.rb +++ b/spec/bundler/install/path_spec.rb @@ -39,7 +39,7 @@ RSpec.describe "bundle install" do it "disallows --path vendor/bundle --system", :bundler => "< 3" do bundle "install --path vendor/bundle --system", :raise_on_error => false expect(err).to include("Please choose only one option.") - expect(exitstatus).to eq(15) if exitstatus + expect(exitstatus).to eq(15) end it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 3" do diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb index 0ad17a2722..a8fd4d51fb 100644 --- a/spec/bundler/other/platform_spec.rb +++ b/spec/bundler/other/platform_spec.rb @@ -170,7 +170,7 @@ G bundle "platform", :raise_on_error => false - expect(exitstatus).not_to eq(0) if exitstatus + expect(exitstatus).not_to eq(0) end it "raises an error if engine_version is used but engine is not" do @@ -183,7 +183,7 @@ G bundle "platform", :raise_on_error => false - expect(exitstatus).not_to eq(0) if exitstatus + expect(exitstatus).not_to eq(0) end it "raises an error if engine version doesn't match ruby version for MRI" do @@ -196,7 +196,7 @@ G bundle "platform", :raise_on_error => false - expect(exitstatus).not_to eq(0) if exitstatus + expect(exitstatus).not_to eq(0) end it "should print if no ruby version is specified" do @@ -265,27 +265,27 @@ G let(:patchlevel_fixnum) { "#{ruby_version_correct}, :patchlevel => #{RUBY_PATCHLEVEL}1" } def should_be_ruby_version_incorrect - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) expect(err).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}") end def should_be_engine_incorrect - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) expect(err).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}") end def should_be_engine_version_incorrect - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) expect(err).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}") end def should_be_patchlevel_incorrect - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) expect(err).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}") end def should_be_patchlevel_fixnum - expect(exitstatus).to eq(18) if exitstatus + expect(exitstatus).to eq(18) expect(err).to be_include("The Ruby patchlevel in your Gemfile must be a string") end diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index bb27482fa5..ac5a28891b 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -149,7 +149,7 @@ RSpec.describe "bundler plugin install" do it "raises an error when both git and local git sources are specified" do bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project", :raise_on_error => false - expect(exitstatus).not_to eq(0) if exitstatus + expect(exitstatus).not_to eq(0) expect(err).to eq("Remote and local plugin git sources can't be both specified") end end -- cgit v1.2.3