Cached object ids won't work, per (long) discussion with Alex

This commit is contained in:
Michael S. Klishin 2012-03-05 20:55:08 +04:00
parent 0f867b8236
commit e54bd37932
2 changed files with 0 additions and 9 deletions

View file

@ -41,8 +41,6 @@
(def factories (atom {})) (def factories (atom {}))
(def defaults (atom {})) (def defaults (atom {}))
(def oids (atom {}))
(defn defaults-for (defn defaults-for
[f-group & { :as attributes }] [f-group & { :as attributes }]
@ -66,10 +64,4 @@
(let [doc (apply build f-group f-name (flatten (vec overrides))) (let [doc (apply build f-group f-name (flatten (vec overrides)))
oid (:_id doc)] oid (:_id doc)]
(assert (mr/ok? (mc/insert f-group doc))) (assert (mr/ok? (mc/insert f-group doc)))
(swap! oids (fn [a]
(assoc-in a [(name f-group) (name f-name)] oid)))
doc))) doc)))
(defn oid-of
[f-group f-name]
(get-in @oids [(name f-group) (name f-name)]))

View file

@ -54,7 +54,6 @@
doc (seed "domains" "clojure.org" :created-at t)] doc (seed "domains" "clojure.org" :created-at t)]
(is (= 1 (mc/count "domains"))) (is (= 1 (mc/count "domains")))
(is (:_id doc)) (is (:_id doc))
(is (= (:_id doc) (oid-of "domains" "clojure.org")))
(is (= t (:created-at doc))) (is (= t (:created-at doc)))
(is (= "clojure.org" (:name doc))) (is (= "clojure.org" (:name doc)))
(is (false? (:ipv6-enabled doc))))) (is (false? (:ipv6-enabled doc)))))