A better solution that looks like it works is this: load the mock module
second. Say I have a module I want to mock:
(ns tomock)
(defn foo [] 4)
and a module that requires it:
(ns totest
(:require tomock))
(defn bar [] (tomock/foo))
So if I create the file mock_tomock.clj which contains:
---- file: mock_tomock.clj ----
(ns mock-tomock)
(def x nil) ; it looks like some symbol in mock is necessary
(ns mock)
(defn foo []
(do
(println "Got here!")
3))
---------
Now if I, in a repl, (require 'totest) and then (require 'mock-tomock),
calls to (totest/bar) call my mocked foo, and not the original foo.
Brian
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en