class Spectator::MockRegistry

Overview

Stores collections of stubs for mocked types.

This type is intended for all mocked modules that have functionality "injected." That is, the type itself has mock functionality bolted on. Adding instance members should be avoided, for instance, it could mess up serialization.

Defined in:

spectator/mocks/mock_registry.cr

Instance Method Summary

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should
, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not

Instance Method Detail

def [](_object = nil) #

Retrieves all stubs.


[View source]
def []?(_object = nil) : Spectator::MockRegistryEntry? #

Retrieves all stubs.


[View source]
def delete(object : Reference) : Nil #

Clears all stubs defined for a mocked object.


[View source]
def fetch(object : Reference, & : -> Array(Stub)) #

Retrieves all stubs.

Yields to the block on the first retrieval. This allows a mock to populate the registry with initial stubs.


[View source]