Fix these early tests to use locals

This commit is contained in:
Michael S. Klishin 2011-12-30 17:10:36 +04:00
parent c25609a5c3
commit ef3c224441

View file

@ -130,9 +130,9 @@
(deftest find-one-full-document-when-collection-has-matches (deftest find-one-full-document-when-collection-has-matches
(let [collection "docs" (let [collection "docs"
doc-id (monger.util/random-uuid) doc-id (monger.util/random-uuid)
doc { :data-store "MongoDB", :language "Clojure", :_id doc-id }] doc { :data-store "MongoDB", :language "Clojure", :_id doc-id }
(mgcol/insert collection doc) _ (mgcol/insert collection doc)
(def ^DBObject found-one (mgcol/find-one collection { :language "Clojure" })) found-one (mgcol/find-one collection { :language "Clojure" })]
(is (= (:_id doc) (monger.util/get-id found-one))) (is (= (:_id doc) (monger.util/get-id found-one)))
(is (= (mgcnv/from-db-object found-one true) doc)) (is (= (mgcnv/from-db-object found-one true) doc))
(is (= (mgcnv/to-db-object doc) found-one)))) (is (= (mgcnv/to-db-object doc) found-one))))
@ -150,9 +150,9 @@
(let [collection "docs" (let [collection "docs"
doc-id (monger.util/random-uuid) doc-id (monger.util/random-uuid)
doc { :data-store "MongoDB", :language "Clojure", :_id doc-id } doc { :data-store "MongoDB", :language "Clojure", :_id doc-id }
fields [:language]] fields [:language]
(mgcol/insert collection doc) _ (mgcol/insert collection doc)
(def ^DBObject loaded (mgcol/find-one collection { :language "Clojure" } fields)) loaded (mgcol/find-one collection { :language "Clojure" } fields)]
(is (nil? (.get ^DBObject loaded "data-store"))) (is (nil? (.get ^DBObject loaded "data-store")))
(is (= doc-id (monger.util/get-id loaded))) (is (= doc-id (monger.util/get-id loaded)))
(is (= "Clojure" (.get ^DBObject loaded "language"))))) (is (= "Clojure" (.get ^DBObject loaded "language")))))