dchelimsky / mockfn

A mocking library for Clojure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

CircleCI

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.

About

A mocking library for Clojure.

License:Eclipse Public License 1.0


Languages

Language:Clojure 100.0%