Created
May 7, 2015 01:45
-
-
Save astahlman/b62b95ab62e48e338246 to your computer and use it in GitHub Desktop.
Example of how def'ing doesn't play nice with Midje prerequisites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns midje-example.mock | |
(:use midje.sweet)) | |
(defn compute [comp-fn] | |
(comp-fn 2 3)) | |
(unfinished mult) | |
;; At compile time... | |
;; #`midje-example.mock/bound-to-mult => #'midje-example.mock/mult | |
(def bound-to-mult mult) | |
(fact "The mock is not invoked when we inject a Var bound to the mocked function" | |
(compute bound-to-mult) => 6 ;; #'midje-example.mock/bound-to-mult => ;; (unfinished mult) | |
(provided | |
(mult 2 3) => 6)) ;; #'midje-example.mock/mult => <mock implementation> | |
(fact "But it is called if we mock the injected Var directly" | |
(compute bound-to-mult) => 6 ;; #'midje-example.mock/bound-to-mult => <mock implementation> | |
(provided | |
(bound-to-mult 2 3) => 6)) ;; #'midje-example.mock/bound-to-mult => <mock implementation> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment