Integration of fhofherr/stub-fn into clojure.test.
Re-exports the [[core/stub-fn]] macro.
It extends clojure.test/assert-expr to provide the invoked? assertion.
The invoked? assertions accepts the same arguments as
[[core/verify-invocations]].
In order to use fhofherr/stub-fn together with clojure.test something
like the following is enough:
(ns my-test-ns
(:require [clojure.test :refer :all]
[fhofherr.stub-fn.clojure.test :refer [stub-fn]]))
(deftest some-test
(let [stubbed-fn (stub-fn stubbed-fn [])]
(stubbed-fn)
(is (invoked? stubbed-fn :times 1))))
Integration of `fhofherr/stub-fn` into `clojure.test`.
Re-exports the [[core/stub-fn]] macro.
It extends `clojure.test/assert-expr` to provide the `invoked?` assertion.
The `invoked?` assertions accepts the same arguments as
[[core/verify-invocations]].
In order to use `fhofherr/stub-fn` together with `clojure.test` something
like the following is enough:
```clojure
(ns my-test-ns
(:require [clojure.test :refer :all]
[fhofherr.stub-fn.clojure.test :refer [stub-fn]]))
(deftest some-test
(let [stubbed-fn (stub-fn stubbed-fn [])]
(stubbed-fn)
(is (invoked? stubbed-fn :times 1))))
```Implements the core functionality of fhofherr/stub-fn.
Users of clojure.test should not use this namespace directly. Instead
they should use fhofherr.stub-fn.clojure.test.
The core functionality is implemented by the stub-fn macro. It creates
an anonymous function which can be used in place of any other function. The
stubbed function tracks information about its invocations under the
::stub-info key in its meta data.
Implements the core functionality of `fhofherr/stub-fn`. Users of `clojure.test` should not use this namespace directly. Instead they should use [[fhofherr.stub-fn.clojure.test]]. The core functionality is implemented by the [[stub-fn]] macro. It creates an anonymous function which can be used in place of any other function. The stubbed function tracks information about its invocations under the `::stub-info` key in its meta data.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |