module Spectator::StubModifiers

Overview

Mixin intended for Stub to return new, modified stubs.

Direct including types

Defined in:

spectator/mocks/exception_stub.cr
spectator/mocks/multi_value_stub.cr
spectator/mocks/proc_stub.cr
spectator/mocks/stub_modifiers.cr
spectator/mocks/value_stub.cr

Instance Method Summary

Instance Method Detail

def and_raise(exception_class : Exception.class, message) #

Returns a new stub that raises an exception.


[View source]
def and_raise(exception : Exception) #

Returns a new stub that raises an exception.


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

Returns a new stub that raises an exception.


[View source]
def and_raise(exception_class : Exception.class) #

Returns a new stub that raises an exception.


[View source]
def and_return(value) #

Returns a new stub that returns a static value.


[View source]
def and_return(value, *values) #

Returns a new stub that returns multiple values in succession.


[View source]
def with(constraint : AbstractArguments | Nil) #

Returns a new stub of the same type with constrained arguments.


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

Returns a new stub of the same type with constrained arguments.


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

Returns a new stub with an argument constraint.


[View source]
abstract def with_constraint(constraint : AbstractArguments | Nil) #

Returns a new stub of the same type with constrained arguments.


[View source]