diff options
author | Homu <homu@barosl.com> | 2015-10-27 09:33:21 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2015-10-27 09:33:21 +0900 |
commit | 2ba15dc9f588cc444d9492a6ed3f66bde2ca2804 (patch) | |
tree | 6d517a7fdbace239f08ad06ed726315f427fd053 | |
parent | 25a979cfd1904363c9b5165be1617ced433269a6 (diff) | |
parent | 1f1f748cccf4e7cae9773f96e105a2ac75ea472f (diff) | |
download | bundler-2ba15dc9f588cc444d9492a6ed3f66bde2ca2804.tar.gz |
Auto merge of #4075 - bundler:reraise-orig-exception, r=segiddins
Fix Gem::SystemExitException initialization
Previously, we would attempt to initialize `Gem::SystemExitException`
without an argument, which would result in an `ArgumentError` since the
argument is required (from Rubygems 1.3 all the way to 2.4).
I don't know how we missed this all this time. Maybe that path is not
even hit anymore.
Anyway, we don't even have to initialize a new exception, just re-raising the
one we've rescued is sufficient.
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 2 | ||||
-rw-r--r-- | spec/bundler/rubygems_integration_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 9750d98bb3..f4c2a12d9d 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -66,7 +66,7 @@ module Bundler rescue Gem::SystemExitException => e Bundler.ui.error "#{e.class}: #{e.message}" Bundler.ui.trace e - raise Gem::SystemExitException + raise end def ruby_engine diff --git a/spec/bundler/rubygems_integration_spec.rb b/spec/bundler/rubygems_integration_spec.rb index decc3d6fa1..6ff2e1db3e 100644 --- a/spec/bundler/rubygems_integration_spec.rb +++ b/spec/bundler/rubygems_integration_spec.rb @@ -18,4 +18,11 @@ describe Bundler::RubygemsIntegration do Bundler.rubygems.validate(spec) end end + + describe "#configuration" do + it "handles Gem::SystemExitException errors" do + allow(Gem).to receive(:configuration) { raise Gem::SystemExitException.new(1) } + expect { Bundler.rubygems.configuration }.to raise_error(Gem::SystemExitException) + end + end end |