class RSpec::Expectations::MultipleExpectationsNotMetError
Exception raised from ‘aggregate_failures` when multiple expectations fail.
@note The constant is defined here but the extensive logic of this class
is lazily defined when `FailureAggregator` is autoloaded, since we do not need to waste time defining that functionality unless `aggregate_failures` is used.
Exception raised from ‘aggregate_failures` when multiple expectations fail.
Attributes
@return [Array<Exception>] The list of expectation failures and other exceptions, combined.
Public Class Methods
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 160 def initialize(failure_aggregator) @failure_aggregator = failure_aggregator @all_exceptions = failures + other_errors end
Public Instance Methods
@return [String] The user-assigned label for the aggregation block.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 135 def aggregation_block_label @failure_aggregator.block_label end
@return [Hash] The metadata hash passed to ‘aggregate_failures`.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 140 def aggregation_metadata @failure_aggregator.metadata end
return [String] A description of the failure/error counts.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 151 def exception_count_description failure_count = pluralize("failure", failures.size) return failure_count if other_errors.empty? error_count = pluralize("other error", other_errors.size) "#{failure_count} and #{error_count}" end
@return [Array<RSpec::Expectations::ExpectationNotMetError>] The list of expectation failures.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 122 def failures @failure_aggregator.failures end
@return [String] The fully formatted exception message.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 117 def message @message ||= (["#{summary}:"] + enumerated_failures + enumerated_errors).join("\n\n") end
@return [Array<Exception>] The list of other exceptions.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 127 def other_errors @failure_aggregator.other_errors end
@return [String] A summary of the failure, including the block label and a count of failures.
# File rspec-expectations/lib/rspec/expectations/failure_aggregator.rb, line 145 def summary "Got #{exception_count_description} from failure aggregation " \ "block#{block_description}" end