struct Spectator::Matchers::ReceiveMatcher

Overview

Matcher that inspects stubbable objects for method calls.

Defined in:

spectator/matchers/receive_matcher.cr

Constructors

Instance Method Summary

Instance methods inherited from struct Spectator::Matchers::Matcher

===(actual : Expression(T)) : Bool
===(other) : Bool
===
, 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 : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(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

def self.new(stub : Stub, count : Count = Count.new(1, nil)) #

Creates the matcher for expecting a method call matching a stub.


[View source]
def self.new(expected : Expression(Symbol)) #

Creates the matcher for expecting a method call with any arguments. expected is an expression evaluating to the method name as a symbol.


[View source]

Instance Method Detail

def at_least(count : Int) : self #

Returns a new matcher that checks that the stub was invoked at least a set amount of times.


[View source]
def at_least_once : self #

Returns a new matcher that checks that the stub was invoked at least once.


[View source]
def at_least_twice : self #

Returns a new matcher that checks that the stub was invoked at least twice.


[View source]
def at_most(count : Int) : self #

Returns a new matcher that checks that the stub was invoked at most a set amount of times.


[View source]
def at_most_once : self #

Returns a new matcher that checks that the stub was invoked at most once.


[View source]
def at_most_twice : self #

Returns a new matcher that checks that the stub was invoked at most twice.


[View source]
def description : String #

Short text about the matcher's purpose.


[View source]
def exactly(count : Int) : self #

Returns a new matcher that checks that the stub was invoked an exact number of times.


[View source]

Actually performs the test against the expression (value or block).


[View source]
def match(actual : Expression(T)) : MatchData forall T #

Actually performs the test against the expression (value or block).


[View source]
def negated_match(actual : Expression(Stubbable) | Expression(StubbedType)) : MatchData #

Performs the test against the expression (value or block), but inverted.


[View source]
def negated_match(actual : Expression(T)) : MatchData forall T #

Performs the test against the expression (value or block), but inverted.


[View source]
def once : self #

Returns a new matcher that checks that the stub was invoked once.


[View source]
def times : self #

Returns self - used for fluent interface.

expect(dbl).to have_received(:foo).exactly(5).times

[View source]
def twice : self #

Returns a new matcher that checks that the stub was invoked twice.


[View source]
def with(*args, **kwargs) : self #

Returns a new matcher with an argument constraint.


[View source]