struct

Mocks::Proxy(T)

Inherits Struct < Value < Object

Forwards stub and call operations to a registry for a single object.

Constructors

new(object : T, scope : Scope = Scope.current)

Creates a new proxy for the specified object and scope.

Source

Instance methods

add_call(call : Call) : Nil

Records a method call made to the object this proxy represents. See: Registry#call_call

Source
add_stub(stub : Stub) : Nil

Adds a stub to the object this proxy represents. See: Registry#add_stub

Source
calls

Retrieves all calls made to an object. See: Registry#calls

Source
find_stub(call : Call) : Stub | Nil

Finds a stub to the object this proxy represents. See: Registry#find_stub

Source
has_stub?(method_name : Symbol)

Checks if an object has a stub configured for the specified method. See: Registry#has_stub?

Source
remove_stub(stub : Stub) : Nil

Removes a stub from the object this proxy represents. See: Registry#remove_stub

Source
reset

Clears all previously defined stubs and recorded calls. See: Registry#clear

Source