Exception: RSpec::Core::MultipleExceptionError
- Includes:
- InterfaceTag
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb
Overview
Provides a single exception instance that provides access to multiple sub-exceptions. This is used in situations where a single individual spec has multiple exceptions, such as one in the ‘it` block and one in an `after` block.
Defined Under Namespace
Modules: InterfaceTag
Instance Attribute Summary collapse
-
#aggregation_block_label ⇒ nil
readonly
Provided only for interface compatibility with ‘RSpec::Expectations::MultipleExpectationsNotMetError`.
-
#aggregation_metadata ⇒ Hash
readonly
Metadata used by RSpec for formatting purposes.
-
#all_exceptions ⇒ Array<Exception>
readonly
The list of failures and other exceptions, combined.
-
#failures ⇒ Array<Exception>
readonly
The list of failures.
-
#other_errors ⇒ Array<Exception>
readonly
The list of other errors.
Instance Method Summary collapse
-
#exception_count_description ⇒ Object
return [String] A description of the failure/error counts.
-
#initialize(*exceptions) ⇒ MultipleExceptionError
constructor
A new instance of MultipleExceptionError.
-
#message ⇒ String
Combines all the exception messages into a single string.
-
#summary ⇒ String
A summary of the failure, including the block label and a count of failures.
Methods included from InterfaceTag
Constructor Details
#initialize(*exceptions) ⇒ MultipleExceptionError
Returns a new instance of MultipleExceptionError.
492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 492 def initialize(*exceptions) super() @failures = [] @other_errors = [] @all_exceptions = [] @aggregation_metadata = { :hide_backtrace => true } @aggregation_block_label = nil exceptions.each { |e| add e } end |
Instance Attribute Details
#aggregation_block_label ⇒ nil (readonly)
Returns Provided only for interface compatibility with ‘RSpec::Expectations::MultipleExpectationsNotMetError`.
489 490 491 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 489 def aggregation_block_label @aggregation_block_label end |
#aggregation_metadata ⇒ Hash (readonly)
Returns Metadata used by RSpec for formatting purposes.
485 486 487 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 485 def @aggregation_metadata end |
#all_exceptions ⇒ Array<Exception> (readonly)
Returns The list of failures and other exceptions, combined.
482 483 484 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 482 def all_exceptions @all_exceptions end |
Instance Method Details
#exception_count_description ⇒ Object
return [String] A description of the failure/error counts.
517 518 519 520 521 522 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 517 def exception_count_description failure_count = Formatters::Helpers.pluralize(failures.size, "failure") return failure_count if other_errors.empty? error_count = Formatters::Helpers.pluralize(other_errors.size, "other error") "#{failure_count} and #{error_count}" end |
#message ⇒ String
RSpec does not actually use this – instead it formats each exception individually.
Returns Combines all the exception messages into a single string.
507 508 509 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 507 def all_exceptions.map(&:message).join("\n\n") end |
#summary ⇒ String
Returns A summary of the failure, including the block label and a count of failures.
512 513 514 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb', line 512 def summary "Got #{exception_count_description}" end |