struct Spectator::Matchers::ReceiveMatcher
Overview
Matcher that inspects stubbable objects for method calls.
Defined in:
spectator/matchers/receive_matcher.crConstructors
-
.new(stub : Stub, count : Count = Count.new(1, nil))
Creates the matcher for expecting a method call matching a stub.
-
.new(expected : Expression(Symbol))
Creates the matcher for expecting a method call with any arguments.
Instance Method Summary
-
#at_least(count : Int) : self
Returns a new matcher that checks that the stub was invoked at least a set amount of times.
-
#at_least_once : self
Returns a new matcher that checks that the stub was invoked at least once.
-
#at_least_twice : self
Returns a new matcher that checks that the stub was invoked at least twice.
-
#at_most(count : Int) : self
Returns a new matcher that checks that the stub was invoked at most a set amount of times.
-
#at_most_once : self
Returns a new matcher that checks that the stub was invoked at most once.
-
#at_most_twice : self
Returns a new matcher that checks that the stub was invoked at most twice.
-
#description : String
Short text about the matcher's purpose.
-
#exactly(count : Int) : self
Returns a new matcher that checks that the stub was invoked an exact number of times.
-
#match(actual : Expression(Stubbable) | Expression(StubbedType)) : MatchData
Actually performs the test against the expression (value or block).
-
#match(actual : Expression(T)) : MatchData forall T
Actually performs the test against the expression (value or block).
-
#negated_match(actual : Expression(Stubbable) | Expression(StubbedType)) : MatchData
Performs the test against the expression (value or block), but inverted.
-
#negated_match(actual : Expression(T)) : MatchData forall T
Performs the test against the expression (value or block), but inverted.
-
#once : self
Returns a new matcher that checks that the stub was invoked once.
-
#times : self
Returns self - used for fluent interface.
-
#twice : self
Returns a new matcher that checks that the stub was invoked twice.
-
#with(*args, **kwargs) : self
Returns a new matcher with an argument constraint.
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 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
Creates the matcher for expecting a method call matching a stub.
Creates the matcher for expecting a method call with any arguments. expected is an expression evaluating to the method name as a symbol.
Instance Method Detail
Returns a new matcher that checks that the stub was invoked at least a set amount of times.
Returns a new matcher that checks that the stub was invoked at least once.
Returns a new matcher that checks that the stub was invoked at least twice.
Returns a new matcher that checks that the stub was invoked at most a set amount of times.
Returns a new matcher that checks that the stub was invoked at most twice.
Returns a new matcher that checks that the stub was invoked an exact number of times.
Actually performs the test against the expression (value or block).
Actually performs the test against the expression (value or block).
Performs the test against the expression (value or block), but inverted.
Performs the test against the expression (value or block), but inverted.
Returns self - used for fluent interface.
expect(dbl).to have_received(:foo).exactly(5).times