abstract struct Spectator::Matchers::Matcher
- Spectator::Matchers::Matcher
- Struct
- Value
- Object
Overview
Common base class for all expectation conditions. A matcher looks at something produced by the SUT and evaluates whether it is correct or not.
Direct Known Subclasses
- Spectator::Matchers::AllMatcher(TMatcher)
- Spectator::Matchers::ArrayMatcher(ExpectedType)
- Spectator::Matchers::AttributesMatcher(ExpectedType)
- Spectator::Matchers::ChangeExactMatcher(ExpressionType, FromType, ToType)
- Spectator::Matchers::ChangeFromMatcher(ExpressionType, FromType)
- Spectator::Matchers::ChangeMatcher(ExpressionType)
- Spectator::Matchers::ChangeRelativeMatcher(ExpressionType)
- Spectator::Matchers::ChangeToMatcher(ExpressionType, ToType)
- Spectator::Matchers::ContainMatcher(ExpectedType)
- Spectator::Matchers::EndWithMatcher(ExpectedType)
- Spectator::Matchers::ExceptionMatcher(ExceptionType, ExpectedType)
- Spectator::Matchers::HaveMatcher(ExpectedType)
- Spectator::Matchers::PredicateMatcher(ExpectedType)
- Spectator::Matchers::ReceiveMatcher
- Spectator::Matchers::RespondMatcher(ExpectedType)
- Spectator::Matchers::StandardMatcher
- Spectator::Matchers::StartWithMatcher(ExpectedType)
- Spectator::Matchers::UnorderedArrayMatcher(ExpectedType)
Defined in:
spectator/matchers/matcher.crConstructors
Instance Method Summary
-
#===(actual : Expression(T)) : Bool
Compares a matcher against a value.
-
#===(other) : Bool
Compares a matcher against a value.
-
#description : String
Short text about the matcher's purpose.
- #initialize
-
#match(actual : Expression(T)) : MatchData forall T
Actually performs the test against the expression (value or block).
-
#negated_match(actual : Expression(T)) : MatchData forall T
Performs the test against the expression (value or block), but inverted.
Instance methods inherited from class Object
should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall Ushould(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_not
Constructor Detail
Instance Method Detail
Compares a matcher against a value. Enables composable matchers.
Short text about the matcher's purpose. This explains what condition satisfies the matcher. The description is used when the one-liner syntax is used.
it { is_expected.to do_something }
The phrasing should be such that it reads "it ___." where the blank is what is returned by this method.
Actually performs the test against the expression (value or block).
Performs the test against the expression (value or block), but inverted.
A successful match with #match
should normally fail for this method, and vice-versa.