mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Remove unneeded trailing conditions on exitstatus
https://github.com/rubygems/rubygems/commit/27e0e4ecb6
This commit is contained in:
parent
547ba6608e
commit
2fafc08aa3
Notes:
git
2020-07-15 16:05:48 +09:00
20 changed files with 52 additions and 52 deletions
|
@ -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-<task>" do
|
||||
|
|
2
spec/bundler/cache/gems_spec.rb
vendored
2
spec/bundler/cache/gems_spec.rb
vendored
|
@ -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
|
||||
|
|
|
@ -58,7 +58,7 @@ RSpec.describe "bundle binstubs <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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 <gem>" 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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")}")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue