class

Mocks::Stub

Inherits Mocks::StubModifiers < Reference < Object

Stand-in behavior for a method.

Constructors

new(method_name : Symbol, arguments : AbstractArgumentsPattern | Nil = nil)

Creates the stub.

Source

Instance methods

===(other : Call) : Bool

Checks if the stub can be used for a method call.

Source
arguments

Arguments necessary to trigger the stub. If nil, any arguments will trigger the stub.

Source
call(args : Args, return_type : U.class = Nil) forall Args, U

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. The type returned by this method must match return_type.

Source
handled?

Indicates whether the stub can handle a method call. Returns false if a stubbable object should use its default behavior (i.e. the original method).

Source
method_name

Name of the method being applied to.

Source
to_s(io : IO) : Nil

Constructs the string representation of the stub.

Source