diff options
author | Agis Anastasopoulos <agis.anast@gmail.com> | 2015-10-26 15:45:10 +0200 |
---|---|---|
committer | Agis Anastasopoulos <agis.anast@gmail.com> | 2015-10-26 15:58:52 +0200 |
commit | 1f1f748cccf4e7cae9773f96e105a2ac75ea472f (patch) | |
tree | a48d34d6ad96dd2869e5e07bb112c835982e55b7 | |
parent | 5a690bb1e3b1df49c1ad9e3b791f5f9b02c8169f (diff) | |
download | bundler-reraise-orig-exception.tar.gz |
Fix Gem::SystemExitException initializationreraise-orig-exception
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 |