clj-fakes.core
Simpler API for working in implicit dynamic context. Implements almost the same set of functions as clj-fakes.context.
*context*
dynamic
You can use this atom in your code but do not alter it directly; instead, always use framework API.
Also see with-fakes macro.
fake*
macro
(fake* form config)
mark-checked
(mark-checked f)
method-was-called
(method-was-called f obj args-matcher)
method-was-called-once
(method-was-called-once f obj args-matcher)
method-was-matched-once
(method-was-matched-once f obj args-matcher)
method-was-not-called
(method-was-not-called f obj)
methods-were-called-in-order
(methods-were-called-in-order & fns-objs-and-matchers)
optional-fake
(optional-fake)
(optional-fake config)
original-val
(original-val a-var)
patch!
macro
(patch! var-expr val)
recorded-fake
macro
(recorded-fake)
(recorded-fake config)
recorded-fake*
macro
(recorded-fake* form)
(recorded-fake* form config)
reify-fake
macro
(reify-fake & specs)
reify-fake*
macro
(reify-fake* form env & specs)
reify-nice-fake
macro
(reify-nice-fake & specs)
reify-nice-fake*
macro
(reify-nice-fake* form env & specs)
unpatch-all!
(unpatch-all!)
was-called
(was-called f args-matcher)
was-called-once
(was-called-once f args-matcher)
was-matched-once
(was-matched-once f args-matcher)
was-not-called
(was-not-called f)
were-called-in-order
(were-called-in-order & fns-and-matchers)
with-fakes
macro
(with-fakes & body)
Defines an implicit dynamic *context* and executes the body in it. Inside the body you can use the simpler clj-fakes.core API instead of clj-fakes.context API.
The block will automatically unpatch all the patched variables and execute self-tests on exiting. Self-tests will not be executed if exception was raised inside the body. Variables are guaranteed to always be unpatched on exiting the block.
with-fakes*
(with-fakes* f & args)
The function which works similarly to with-fakes macro. It defines an implicit dynamic *context* and executes function f
with specified arguments inside the context.
It is left in mostly for backwards compatibility because previously macro was based on this public function.