class

Spectator::ProcStub(T)

Inherits Spectator::TypedStub / Spectator::Stub / Spectator::StubModifiers / Reference / Object

Stub that responds with a value returned by calling a proc.

Constructors

new(method : Symbol, proc : Proc(AbstractArguments, T), constraint : AbstractArguments | Nil = nil, location : Location | Nil = nil)

Creates the stub.

Source
new(method : Symbol, constraint : AbstractArguments | Nil = nil, location : Location | Nil = nil, &block : Proc(AbstractArguments, T))

Creates the stub.

Source

Instance methods

call(call : MethodCall) : T

Invokes the stubbed implementation.

Source
with_constraint(constraint : AbstractArguments | Nil)

Returns a new stub with constrained arguments.

Source