class

Spectator::MockRegistry

Inherits Reference / Object

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.

Instance methods

[](_object = nil)

Retrieves all stubs.

Source
[]?(_object = nil) : Spectator::MockRegistryEntry?

Retrieves all stubs.

Source
delete(object : Reference) : Nil

Clears all stubs defined for a mocked object.

Source
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.

Source