The core of Dynamock.
The core of Dynamock.
Dynamock stub registry. (Avoid accessing and manipulating this directly.)
Dynamock stub registry. (Avoid accessing and manipulating this directly.)
(stub! f stub)
Register a stub in the current stub-scope for a given mocked function (f).
Register a stub in the current stub-scope for a given mocked function (f).
(with-mock f mock & body)
Mock invocations of function (f) in the body. The function will be replaced with the result of the given mock-builder function (mock).
The mock-builder will be passed 2 parameters:
After invocation, the mock-builder should return a function (the mock) with a compatible parameter list as the function being mocked.
Automatically defines a new stub-scope for the body.
Mock invocations of function (f) in the body. The function will be replaced with the result of the given mock-builder function (mock). The mock-builder will be passed 2 parameters: 1. the original function, which the mock can optionally use. 2. a function, taking no parameters which when called returns a list of registered stubs for the mock. After invocation, the mock-builder should return a function (the mock) with a compatible parameter list as the function being mocked. Automatically defines a new stub-scope for the body.
(with-stub f stub & body)
Register stub for a mocked function (f) that will be available in body. Automatically places the stub in a new stub-scope.
Register stub for a mocked function (f) that will be available in body. Automatically places the stub in a new stub-scope.
(with-stub-scope & body)
Scope stubs registered in the body with stub!
to a new dynamic scope.
Scope stubs registered in the body with `stub!` to a new dynamic scope.
(with-stubs f stubs & body)
Same as with-stub
but registers multiple stubs at once when grouped
together in a vector.
Same as `with-stub` but registers multiple stubs at once when grouped together in a vector.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close