Module: RSpec::Core::MultipleExceptionError::InterfaceTag Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | rspec-core/lib/rspec/core/formatters/exception_presenter.rb |
Overview
Used so there is a common module in the ancestor chain of this class and ::RSpec::Expectations::MultipleExpectationsNotMetError
, which allows code to detect exceptions that are instances of either, without first checking to see if rspec-expectations is loaded.
Class Method Summary
-
.for(ex)
Internal use only
Provides a way to force
ex
to be something that satisfies the multiple exception error interface.
Instance Method Summary
-
#add(exception)
Internal use only
Appends the provided exception to the list.
Class Method Details
.for(ex)
Provides a way to force ex
to be something that satisfies the multiple exception error interface. If it already satisfies it, it will be returned; otherwise it will wrap it in a ::RSpec::Core::MultipleExceptionError
.
# File 'rspec-core/lib/rspec/core/formatters/exception_presenter.rb', line 499
def self.for(ex) return ex if self === ex MultipleExceptionError.new(ex) end
Instance Method Details
#add(exception)
Appends the provided exception to the list.
# File 'rspec-core/lib/rspec/core/formatters/exception_presenter.rb', line 473
def add(exception) # `PendingExampleFixedError` can be assigned to an example that initially has no # failures, but when the `aggregate_failures` around hook completes, it notifies of # a failure. If we do not ignore `PendingExampleFixedError` it would be surfaced to # the user as part of a multiple exception error, which is undesirable. While it's # pretty weird we handle this here, it's the best solution I've been able to come # up with, and `PendingExampleFixedError` always represents the _lack_ of any exception # so clearly when we are transitioning to a `MultipleExceptionError`, it makes sense to # ignore it. return if Pending::PendingExampleFixedError === exception return if exception == self all_exceptions << exception if exception.class.name =~ /RSpec/ failures << exception else other_errors << exception end end