Liking cljdoc? Tell your friends :D

mockfn

mockfn is a Clojure(script) library supporting mockist test-driven-development in Clojure. It is meant to be used alongside a regular testing framework such as clojure.test.

Clojars Project

Usage

The providing macro replaces a function with a configured mock.

(deftest providing-test
  (providing
    [(one-fn) :mocked]
    (is (= :mocked (one-fn)))))

The verifying macro works similarly, but also defines an expectation for the number of times a call should be performed during the test.

(deftest verifying-test
  (verifying
    [(one-fn) :mocked (at-least 1)]
    (is (= :mocked (one-fn)))))

Refer to the documentation for more detailed information, including:

License

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation? These fine people already did:
Pedro Matiello, David Chelimsky & Phillip Mates
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close