Simple mocking and stubbing for Clojure unit-tests. Supports Clojure 1.2 through 1.5.
Simple mocking and stubbing for Clojure unit-tests. Supports Clojure 1.2 through 1.5.
Has a value of true when inside one of the Conjure faking macros. Used to give users helpful error messages.
Has a value of true when inside one of the Conjure faking macros. Used to give users helpful error messages.
(assert-conjurified-fn macro-name fn-name)
Used internally by Conjure to make sure verify-x macros are only called on
functions that have been used in mocking
, stubbing
, or instrumenting
Used internally by Conjure to make sure verify-x macros are only called on functions that have been used in `mocking`, `stubbing`, or `instrumenting`
(assert-in-fake-context macro-name)
Used internally by Conjure to make sure verify-x
macros ae only called from with Conjure's fakes
Used internally by Conjure to make sure `verify-x` macros ae only called from with Conjure's fakes
Atom holding a map of faked function names to the arglist that they were called with. This is used internally by Conjure.
Atom holding a map of faked function names to the arglist that they were called with. This is used internally by Conjure.
(instrumented-fn f)
Wraps a function, instrumenting it to record information about when it was called. The actual function is still called. This is used internally by Conjure.
Wraps a function, instrumenting it to record information about when it was called. The actual function is still called. This is used internally by Conjure.
(instrumenting fn-names & body)
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. The original function is still called.
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. The original function is still called.
(mock-fn function-name)
Wraps a function, instrumenting it to record information about when it was called, and stubbing it to return nil. This is used internally by Conjure.
Wraps a function, instrumenting it to record information about when it was called, and stubbing it to return nil. This is used internally by Conjure.
(mocking fn-names & body)
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. The original function is not actually called, instead a a return value of nil is produced and nothing is executed.
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. The original function is not actually called, instead a a return value of nil is produced and nothing is executed.
(mocking-private fn-names & body)
Allows using Conjure's mocking
macro with private definitions.
It works by mocking public definitions and then using with-redefs
to redefine the private ones.
Allows using Conjure's `mocking` macro with private definitions. It works by mocking public definitions and then using `with-redefs` to redefine the private ones.
(stub-fn f return-value)
Wraps a function, instrumenting it to record information about when it was called, and to return the return-value specified. The actual function is never called. This is used internally by Conjure.
Wraps a function, instrumenting it to record information about when it was called, and to return the return-value specified. The actual function is never called. This is used internally by Conjure.
(stub-fn-with-return-vals & return-vals)
Creates a anonymous function that, on each successive call, returns the next item in the supplied return values. When it runs out of values to return, will continually return the rightmost supplied return value. Meant to be used on the righthand side of a stubbing macro's binding.
Creates a anonymous function that, on each successive call, returns the next item in the supplied return values. When it runs out of values to return, will continually return the rightmost supplied return value. Meant to be used on the righthand side of a stubbing macro's binding.
(stubbing stub-forms & body)
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. This is like mocking, except you also specify the return value of the faked functions. If the return value is specified as a function, then that function will be used as the stub (it won't return the function - instead the function will be used in pace of the orginal.
Within the body of this macro you may use the various conjure verify-* macros to make assertions about how the mocked functions have been called. This is like mocking, except you also specify the return value of the faked functions. If the return value is specified as a function, then that function will be used as the stub (it won't return the function - instead the function will be used in pace of the orginal.
(stubbing-private bindings & body)
Allows using Conjure's stubbing
macro with private definitions.
Allows using Conjure's `stubbing` macro with private definitions.
(verify-call-times-for fn-name n)
Asserts that the faked function was called n times
Asserts that the faked function was called n times
(verify-called-once-with-args fn-name & args)
Asserts that the faked function was called exactly once, and was passed the args specified
Asserts that the faked function was called exactly once, and was passed the args specified
(verify-first-call-args-for fn-name & args)
Asserts that the faked function was called at least once, and the first call was passed the args specified
Asserts that the faked function was called at least once, and the first call was passed the args specified
(verify-first-call-args-for-indices fn-name indices & args)
Asserts that the function was called at least once, and the first call was passed the args specified, into the indices of the arglist specified. In other words, it checks only the particular args you care about.
Asserts that the function was called at least once, and the first call was passed the args specified, into the indices of the arglist specified. In other words, it checks only the particular args you care about.
(verify-nth-call-args-for n fn-name & args)
Asserts that the function was called n times, and the nth time was passed the args specified
Asserts that the function was called n times, and the nth time was passed the args specified
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close