Get rid of monger.util/with-ns

It was an awful hack, now replaced by a less awful one.
This commit is contained in:
Michael S. Klishin 2011-09-19 12:31:29 +04:00
parent 189d2366ab
commit c5850bd59f
3 changed files with 4 additions and 13 deletions

View file

@ -29,13 +29,6 @@
[]
(ObjectId.))
(defmacro with-ns
"Evaluates body in another namespace. ns is either a namespace object or a symbol.
This makes it possible to define functions in namespaces other than the current one."
[ns & body]
`(binding [*ns* (the-ns ~ns)]
~@(map (fn [form] `(eval '~form)) body)))
(defprotocol GetDocumentId
(get-id [input] "Returns document id"))

View file

@ -8,9 +8,8 @@
[clojure stacktrace])
(:use [clojure.test]))
(monger.util/with-ns 'monger.core
(defonce ^:dynamic *mongodb-connection* (monger.core/connect))
(defonce ^:dynamic *mongodb-database* (monger.core/get-db "monger-test")))
(monger.core/connect!)
(monger.core/set-db! (monger.core/get-db "monger-test"))
;;

View file

@ -4,9 +4,8 @@
(:use [clojure.test]))
(monger.util/with-ns 'monger.core
(defonce ^:dynamic *mongodb-connection* (monger.core/connect))
(defonce ^:dynamic *mongodb-database* (monger.core/get-db "monger-test")))
(monger.core/connect!)
(monger.core/set-db! (monger.core/get-db "monger-test"))