From c5850bd59fee57dba2ef23a0dc169f33158bad5d Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Mon, 19 Sep 2011 12:31:29 +0400 Subject: [PATCH] Get rid of monger.util/with-ns It was an awful hack, now replaced by a less awful one. --- src/monger/util.clj | 7 ------- test/monger/test/collection.clj | 5 ++--- test/monger/test/result.clj | 5 ++--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/monger/util.clj b/src/monger/util.clj index 698251e..8651ab3 100644 --- a/src/monger/util.clj +++ b/src/monger/util.clj @@ -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")) diff --git a/test/monger/test/collection.clj b/test/monger/test/collection.clj index 38663d6..c785e57 100644 --- a/test/monger/test/collection.clj +++ b/test/monger/test/collection.clj @@ -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")) ;; diff --git a/test/monger/test/result.clj b/test/monger/test/result.clj index 8317ccb..b77e740 100644 --- a/test/monger/test/result.clj +++ b/test/monger/test/result.clj @@ -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"))