This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ def run(example_group_instance, reporter)
227
227
rescue Pending ::SkipDeclaredInExample
228
228
# no-op, required metadata has already been set by the `skip`
229
229
# method.
230
- rescue Support :: AllExceptionsExceptOnesWeMustNotRescue => e
230
+ rescue AllExceptionsExcludingDangerousOnesOnRubiesThatAllowIt => e
231
231
set_exception ( e )
232
232
ensure
233
233
run_after_example
@@ -245,6 +245,20 @@ def run(example_group_instance, reporter)
245
245
RSpec . current_example = nil
246
246
end
247
247
248
+ if RSpec ::Support ::Ruby . jruby? || RUBY_VERSION . to_f < 1.9
249
+ # :nocov:
250
+ # For some reason, rescuing `Support::AllExceptionsExceptOnesWeMustNotRescue`
251
+ # in place of `Exception` above can cause the exit status to be the wrong
252
+ # thing. I have no idea why. See:
253
+ # https://github.com/rspec/rspec-core/pull/2063#discussion_r38284978
254
+ # @private
255
+ AllExceptionsExcludingDangerousOnesOnRubiesThatAllowIt = Exception
256
+ # :nocov:
257
+ else
258
+ # @private
259
+ AllExceptionsExcludingDangerousOnesOnRubiesThatAllowIt = Support ::AllExceptionsExceptOnesWeMustNotRescue
260
+ end
261
+
248
262
# Wraps both a `Proc` and an {Example} for use in {Hooks#around
249
263
# around} hooks. In around hooks we need to yield this special
250
264
# kind of object (rather than the raw {Example}) because when
You can’t perform that action at this time.
0 commit comments