abstract struct Spectator::Matchers::ValueMatcher(ExpectedType)
- Spectator::Matchers::ValueMatcher(ExpectedType)
- Spectator::Matchers::StandardMatcher
- Spectator::Matchers::Matcher
- Struct
- Value
- Object
Overview
Category of matcher that uses a value. Matchers of this type expect that a SUT applies to the value in some way.
Matchers based on this class need to define #match? and #failure_message.
If the matcher can be negated,
the #failure_message_when_negated method needs to be overridden.
Additionally, the #does_not_match? method can be specified
if there's custom behavior for negated matches.
If the matcher operates on or has extra data that is useful for debug,
then the #values and #negated_values methods can be overridden.
Finally, define a #description message that can be used for the one-liner "it" syntax.
The failure messages should typically only contain the test expression labels.
Actual values should be returned by #values and #negated_values.
Direct Known Subclasses
- Spectator::Matchers::CaseMatcher(ExpectedType)
- Spectator::Matchers::CollectionMatcher(ExpectedType)
- Spectator::Matchers::EqualityMatcher(ExpectedType)
- Spectator::Matchers::GreaterThanEqualMatcher(ExpectedType)
- Spectator::Matchers::GreaterThanMatcher(ExpectedType)
- Spectator::Matchers::HaveKeyMatcher(ExpectedType)
- Spectator::Matchers::HavePredicateMatcher(ExpectedType)
- Spectator::Matchers::HaveValueMatcher(ExpectedType)
- Spectator::Matchers::InequalityMatcher(ExpectedType)
- Spectator::Matchers::LessThanEqualMatcher(ExpectedType)
- Spectator::Matchers::LessThanMatcher(ExpectedType)
- Spectator::Matchers::PatternMatcher(ExpectedType)
- Spectator::Matchers::RangeMatcher(ExpectedType)
- Spectator::Matchers::ReferenceMatcher(ExpectedType)
- Spectator::Matchers::RegexMatcher(ExpectedType)
- Spectator::Matchers::SizeMatcher(ExpectedType)
- Spectator::Matchers::SizeOfMatcher(ExpectedType)
Defined in:
spectator/matchers/value_matcher.crConstructors
- 
        .new(expected : Value(ExpectedType))
        
          Creates the value matcher. 
Instance methods inherited from struct Spectator::Matchers::StandardMatcher
  
  
    
      match(actual : Expression(T)) : MatchData forall T
    match, 
    
  
    
      negated_match(actual : Expression(T)) : MatchData forall T
    negated_match
    
  
    
    
  
    
  Instance methods inherited from struct Spectator::Matchers::Matcher
  
  
    
      description : String
    description, 
    
  
    
      initialize
    initialize, 
    
  
    
      match(actual : Expression(T)) : MatchData forall T
    match, 
    
  
    
      negated_match(actual : Expression(T)) : MatchData forall T
    negated_match
    
  
    
  Constructor methods inherited from struct Spectator::Matchers::Matcher
  
  
    
      new
    new
    
  
    
  
    
    
    
  
    
    
    
  
    
  Instance methods inherited from class Object
  
  
    
      should(matcher, message = nil)
    should, 
    
  
    
      should_eventually(matcher, message = nil)
    should_eventually, 
    
  
    
      should_never(matcher, message = nil)
    should_never, 
    
  
    
      should_not(matcher, message = nil)
    should_not
    
  
    
    
  
Constructor Detail
Creates the value matcher. The expected value is stored for later use.