class Spectator::Mocks::ProcStub(T)
- Spectator::Mocks::ProcStub(T)
- Spectator::Mocks::Stub
- Reference
- Object
Overview
Stub that calls a proc and returns its return value.
Defined in:
spectator/mocks/proc_stub.crConstructors
- .new(method_name : Symbol, proc : -> T, arguments : AbstractArgumentsPattern | Nil = nil)
- .new(method_name : Symbol, arguments : AbstractArgumentsPattern | Nil = nil, &proc : -> T)
Instance Method Summary
-
#call(args : Arguments, return_type : U.class = U, & : -> U) forall U
Invokes the stub.
Instance methods inherited from class Spectator::Mocks::Stub
===(call : Call) : Bool
===,
arguments : AbstractArgumentsPattern | Nil
arguments,
call(args : Arguments, return_type : U.class = U, & : -> U) forall U
call,
method_name : Symbol
method_name,
to_s(io : IO) : Nil
to_s
Constructor methods inherited from class Spectator::Mocks::Stub
new(method_name : Symbol, arguments : AbstractArgumentsPattern | Nil = nil)
new
Instance methods inherited from module Spectator::Mocks::StubModifiers
and_raise(exception : Exception)and_raise(message : String | Nil = nil)
and_raise(exception_type : Exception.class, *args, **kwargs) and_raise, and_return(value) and_return, with(*args, **kwargs)
with(*args, **kwargs, &block : -> _) with
Constructor Detail
def self.new(method_name : Symbol, arguments : AbstractArgumentsPattern | Nil = nil, &proc : -> T)
#
Instance Method Detail
Description copied from class Spectator::Mocks::Stub
Invokes the stub. args are the arguments passed to the method call. The return_type indicates the type expected to be returned by the stub. A block must be passed that invokes the original method or fallback behavior. The type returned by the block must match return_type.