Skip to content

Instantly share code, notes, and snippets.

@ordnungswidrig
Created January 25, 2010 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ordnungswidrig/285739 to your computer and use it in GitHub Desktop.
Save ordnungswidrig/285739 to your computer and use it in GitHub Desktop.
;; functions under test
(defn xx [a b]
10)
(defn yy [z]
20)
(defn fn-under-test []
(xx 1 2)
(yy "blah"))
(defn another-fn-under-test []
(+ (xx nil nil) (yy nil)))
;; mocking à la clojure
(deftest test-basic-mocking
(mocking [xx yy]
(fn-under-test))
(verify-call-times-for xx 1)
(verify-call-times-for yy 1)
(verify-first-call-args-for xx 1 2)
(verify-first-call-args-for yy "blah"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment