Class: Ward::Matchers::Predicate
- Defined in:
- lib/ward/matchers/predicate.rb
Overview
Tests that a predicate method responds with true.
Instance Attribute Summary
Attributes inherited from Matcher
Instance Method Summary collapse
-
#matches?(actual) ⇒ Boolean
Returns whether the given value is responds true to the predicate.
Methods inherited from Matcher
#customise_error_values, error_id, #initialize
Constructor Details
This class inherits a constructor from Ward::Matchers::Matcher
Instance Method Details
#matches?(actual) ⇒ Boolean
Returns whether the given value is responds true to the predicate.
22 23 24 25 26 27 |
# File 'lib/ward/matchers/predicate.rb', line 22 def matches?(actual) raise ArgumentError, "#{actual.inspect} does not respond " \ "to #{expected}" unless actual.respond_to?(@expected) actual.__send__(@expected) end |