[fhofherr/stub-fn "0.1.0-SNAPSHOT"]
A macro to stub arbitrary Clojure functions.
stub-fn is available on Clojars. To use it in your project add the following to your project.clj dependency vector:
[fhofherr/stub-fn "0.1.0-SNAPSHOT"]
clojure.testIf you do not use clojure.test require the fhofherr.stub-fn.core namespace. To stub a function use the stub-fn macro. To verify invocations use either verify-invocations or invoked?.
clojure.testUsers of clojure.test should use the fhofherr.stub-fn.clojure.test namespace instead. It re-exports the stub-fn macro and extends clojure.test to enable verification of invocations using the test-is macro. Instead of using fhofherr.stub-fn.core/verify-invocations users can do the following:
(ns some-test-ns
(:require [clojure.test :refer :all]
[fhofherr.stub-fn.clojure.test :refer [stub-fn]]))
(deftest using-test-is
(let [f (stub-fn f [x])]
(f 1)
(is (invoked? f :times 1 :args {'x 1}))))
Copyright © 2017 Ferdinand Hofherr
Distributed under the MIT License.
Can you improve this documentation?Edit on GitHub
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 |