amitrathore / conjure

a mocking library for clojure
http://s-expressions.com
73 stars 9 forks source link

Be able to write macros that call to `stubbing` under the hood #2

Closed AlexBaranosky closed 12 years ago

AlexBaranosky commented 12 years ago

Currently this fails to work:

(defmacro unit-test [& body]
  `(stubbing [config {}
              get-some-summary { }         
              log-message (fn [~'& msgs#] (apply println "LOG: " msgs#))]
     ~@body))

What happens, if you try to use this macro that you've used while in another ns, is that the macro expands out to code which contains a reference to stub-fn which is a Conjure function. Instead this needs to expand out to something including org.rathore.amit.conjure.core/stub-fn. Then the namespace which defines unit-test just has to require org.rathore.amit.conjure.core.