module Spectator::Mocks::StubModifiers

Overview

Modifiers used to change the behavior of a stub applied to a method. This makes up part of the fluent interface for the DSL.

Direct including types

Defined in:

spectator/mocks/stub_modifiers.cr

Instance Method Summary

Instance Method Detail

def and_raise(exception : Exception) #

Modifies the stub to raise an exception.


[View source]
def and_raise(message : String | Nil = nil) #

Modifies the stub to raise an exception. A RuntimeError with the specified message will be raised when the stub is called.


[View source]
def and_raise(exception_type : Exception.class, *args, **kwargs) #

Modifies the stub to raise an exception. Creates a new exception of the specified type and forwards additional arguments to it.


[View source]
def and_return(value) #

Modifies the stub to return a value.


[View source]
def with(*args, **kwargs) #

Modifies the stub to only respond to the specified arguments.


[View source]
def with(*args, **kwargs, &block : -> _) #

Modifies the stub to only response to the specified arguments and invoke a block.


[View source]