Class: Mocha::ParameterMatchers::Base Abstract
- Defined in:
- lib/mocha/parameter_matchers/base.rb
Overview
Subclass and implement #matches?
and #mocha_inspect
to define a custom matcher. Also add a suitably named instance method to Mocha::ParameterMatchers to build an instance of the new matcher c.f. #equals.
Direct Known Subclasses
AllOf, AnyOf, AnyParameters, Anything, Equals, HasEntries, HasEntry, HasKey, HasValue, Includes, InstanceOf, IsA, KindOf, Not, Optionally, QueryStringMatches, RegexpMatches, RespondsWith, YamlEquivalent
Instance Method Summary collapse
-
#&(matcher) ⇒ AllOf
A shorthand way of combining two matchers when both must match.
- #to_matcher ⇒ Object
-
#|(matcher) ⇒ AnyOf
A shorthand way of combining two matchers when at least one must match.
Instance Method Details
#&(matcher) ⇒ AllOf
33 34 35 |
# File 'lib/mocha/parameter_matchers/base.rb', line 33 def &(matcher) AllOf.new(self, matcher) end |
#to_matcher ⇒ Object
9 10 11 |
# File 'lib/mocha/parameter_matchers/base.rb', line 9 def to_matcher self end |
#|(matcher) ⇒ 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.
63 64 65 |
# File 'lib/mocha/parameter_matchers/base.rb', line 63 def |(matcher) AnyOf.new(self, matcher) end |