Mocks::Registry
Inherits Reference < Object
Stores and retrieves method stubs and calls for multiple objects.
Reference-based objects are tracked by their #object_id (memory address).
Value-based objects are tracked by their byte-wise representation.
NOTE: This approach does not work for mutable values, and their use is generally discouraged. This also implies that two separate values with the same content will be tracked as the same object.
See: https://crystal-lang.org/reference/latest/syntax_and_semantics/structs.html
Instance methods
find_stub(object, call : Call) : Stub | Nil
Finds a stub suitable stub for a method call. Returns nil if no stub was found. Stubs are searched in reverse order so that newly define stubs take precedence.
has_stub?(object, method_name : Symbol)
Checks if an object has a stub configured for the specified method.