Module: Mocha::ParameterMatchers::BaseMethods Abstract
- Included in:
- AllOf, AnyOf, AnyParameters, Anything, Equals, EquivalentUri, HasEntries, HasEntry, HasKey, HasKeys, HasValue, Includes, InstanceOf, IsA, KindOf, Not, Optionally, RegexpMatches, RespondsWith, YamlEquivalent
- Defined in:
- lib/mocha/parameter_matchers/base_methods.rb
Overview
This module is abstract.
Include and implement #matches? and #mocha_inspect to define a custom matcher. Also add a suitably named instance method to Methods to build an instance of the new matcher c.f. Methods#equals.
Instance Method Summary collapse
-
#&(other) ⇒ AllOf
A shorthand way of combining two matchers when both must match.
-
#|(other) ⇒ AnyOf
A shorthand way of combining two matchers when at least one must match.
Instance Method Details
#&(other) ⇒ AllOf
29 30 31 |
# File 'lib/mocha/parameter_matchers/base_methods.rb', line 29 def &(other) AllOf.new(self, other) end |
#|(other) ⇒ AnyOf
A shorthand way of combining two matchers when at least one must match.
Returns a new AnyOf parameter matcher combining two matchers using a logical OR.
This shorthand will not work with an implicit equals match. Instead, an explicit Equals matcher should be used.
59 60 61 |
# File 'lib/mocha/parameter_matchers/base_methods.rb', line 59 def |(other) AnyOf.new(self, other) end |