Exception: RSpec::Expectations::MultipleExpectationsNotMetError
- Inherits:
-
ExpectationNotMetError
- Object
- Exception
- ExpectationNotMetError
- RSpec::Expectations::MultipleExpectationsNotMetError
- Defined in:
- lib/rspec/expectations.rb,
lib/rspec/expectations/failure_aggregator.rb
Overview
Exception raised from aggregate_failures
when multiple expectations fail.
Instance Attribute Summary collapse
-
#all_exceptions ⇒ Array<Exception>
readonly
The list of expectation failures and other exceptions, combined.
Instance Method Summary collapse
-
#aggregation_block_label ⇒ String
The user-assigned label for the aggregation block.
-
#aggregation_metadata ⇒ Hash
The metadata hash passed to
aggregate_failures
. -
#exception_count_description ⇒ Object
return [String] A description of the failure/error counts.
-
#failures ⇒ Array<RSpec::Expectations::ExpectationNotMetError>
The list of expectation failures.
-
#message ⇒ String
The fully formatted exception message.
-
#other_errors ⇒ Array<Exception>
The list of other exceptions.
-
#summary ⇒ String
A summary of the failure, including the block label and a count of failures.
Instance Attribute Details
#all_exceptions ⇒ Array<Exception> (readonly)
Returns The list of expectation failures and other exceptions, combined.
132 133 134 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 132 def all_exceptions @all_exceptions end |
Instance Method Details
#aggregation_block_label ⇒ String
Returns The user-assigned label for the aggregation block.
135 136 137 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 135 def aggregation_block_label @failure_aggregator.block_label end |
#aggregation_metadata ⇒ Hash
Returns The metadata hash passed to aggregate_failures
.
140 141 142 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 140 def @failure_aggregator. end |
#exception_count_description ⇒ Object
return [String] A description of the failure/error counts.
151 152 153 154 155 156 |
# File '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 |
#failures ⇒ Array<RSpec::Expectations::ExpectationNotMetError>
Returns The list of expectation failures.
122 123 124 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 122 def failures @failure_aggregator.failures end |
#message ⇒ String
Returns The fully formatted exception message.
117 118 119 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 117 def @message ||= (["#{summary}:"] + enumerated_failures + enumerated_errors).join("\n\n") end |
#other_errors ⇒ Array<Exception>
Returns The list of other exceptions.
127 128 129 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 127 def other_errors @failure_aggregator.other_errors end |
#summary ⇒ String
Returns A summary of the failure, including the block label and a count of failures.
145 146 147 148 |
# File 'lib/rspec/expectations/failure_aggregator.rb', line 145 def summary "Got #{exception_count_description} from failure aggregation " \ "block#{block_description}" end |