abstract class Mocks::Stub
- Mocks::Stub
- Reference
- Object
Overview
Stand-in behavior for a method.
Included Modules
Direct Known Subclasses
- Mocks::CallOriginalStub
- Mocks::ExceptionStub
- Mocks::MultiValueStub(T)
- Mocks::NilStub
- Mocks::ProcStub(T)
- Mocks::ValueStub(T)
Defined in:
mocks/stub.crConstructors
Instance Method Summary
-
#===(call : Call) : Bool
Checks if the stub can be used for a method call.
-
#arguments : AbstractArgumentsPattern | Nil
Arguments necessary to trigger the stub.
-
#call(args : Args, return_type : U.class = Nil) forall Args, U
Invokes the stub.
-
#handled?
Indicates whether the stub can handle a method call.
-
#method_name : Symbol
Name of the method being applied to.
-
#to_s(io : IO) : Nil
Constructs the string representation of the stub.
Instance methods inherited from module Mocks::StubModifiers
and_call_original
and_call_original,
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(value, *values)
and_return and_return, with(*args, **kwargs)
with(*args, **kwargs, &block : -> _) with
Constructor Detail
Creates the stub.
Instance Method Detail
def arguments : AbstractArgumentsPattern | Nil
#
Arguments necessary to trigger the stub. If nil, any arguments will trigger the 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. The type returned by this method must match return_type.
def 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).