abstract class Spectator::Stub
- Spectator::Stub
- Reference
- Object
Overview
Untyped response to a method call (message).
Included Modules
Direct Known Subclasses
Defined in:
spectator/mocks/stub.crConstructors
-
.new(method : Symbol, constraint : AbstractArguments | Nil = nil, location : Location | Nil = nil)
Creates the base of the stub.
Instance Method Summary
-
#===(call : MethodCall)
Checks if a method call should receive the response from this stub.
-
#constraint : AbstractArguments | Nil
Arguments the method must have been called with to provide this response.
-
#location : Location | Nil
Location the stub was defined.
-
#message(io : IO) : Nil
String representation of the stub, formatted as a method call.
-
#message
String representation of the stub, formatted as a method call.
-
#method : Symbol
Name of the method this stub is for.
-
#to_s(io : IO) : Nil
String representation of the stub, formatted as a method definition.
Instance methods inherited from module Spectator::StubModifiers
and_raise(exception_class : Exception.class, message)and_raise(exception : Exception)
and_raise(message : String | Nil = nil)
and_raise(exception_class : Exception.class) and_raise, and_return(value)
and_return(value, *values) and_return, with(constraint : AbstractArguments | Nil)
with(*args, **kwargs)
with(*args, **kwargs, &block : AbstractArguments -> T) forall T with, with_constraint(constraint : AbstractArguments | Nil) with_constraint
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
def self.new(method : Symbol, constraint : AbstractArguments | Nil = nil, location : Location | Nil = nil)
#
Creates the base of the stub.
Instance Method Detail
def constraint : AbstractArguments | Nil
#
Arguments the method must have been called with to provide this response. Is nil when there's no constraint - only the method name must match.