Class: Smartest::OrMatcher
Constant Summary
CompoundMatcher::NEGATED_EXPECTATION_ERROR
Instance Attribute Summary
#matchers
Instance Method Summary
collapse
#initialize, #negated_expectation_error, #supports_negated_expectation?
Methods inherited from Matcher
#and, #or
Instance Method Details
#description ⇒ Object
207
208
209
|
# File 'lib/smartest/matchers.rb', line 207
def description
joined_description(" or ")
end
|
#failure_message ⇒ Object
197
198
199
200
201
|
# File 'lib/smartest/matchers.rb', line 197
def failure_message
message = "expected #{actual_description} to match any of #{description}"
details = failure_messages
details.empty? ? message : "#{message}; #{details.join('; ')}"
end
|
#matches?(actual) ⇒ Boolean
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/smartest/matchers.rb', line 181
def matches?(actual)
reset_result
@actual = actual
@matchers.each do |matcher|
if matcher.matches?(actual)
@matched_matchers << matcher
return true
end
@failed_matchers << matcher
end
false
end
|
#negated_failure_message ⇒ Object
203
204
205
|
# File 'lib/smartest/matchers.rb', line 203
def negated_failure_message
"expected #{actual_description} not to match any of #{description}"
end
|