More robust test, does not depend on test run order and concurrently running tests

This commit is contained in:
Michael S. Klishin 2012-06-19 12:21:28 +04:00
parent 0a2fdc8cc3
commit 2fc81a8180

View file

@ -19,6 +19,7 @@
(let [db (mg/get-db "monger-test") (let [db (mg/get-db "monger-test")
coll "meta.migrations" coll "meta.migrations"
key "1"] key "1"]
(mc/remove db coll {})
(is (not (mc/any? db coll {:_id key}))) (is (not (mc/any? db coll {:_id key})))
(is (not (contains? (applied-migration-ids db) key))) (is (not (contains? (applied-migration-ids db) key)))
(add-migration-id db key) (add-migration-id db key)
@ -30,6 +31,7 @@
(let [db (mg/get-db "monger-test") (let [db (mg/get-db "monger-test")
coll "meta.migrations" coll "meta.migrations"
key "1"] key "1"]
(mc/remove db coll {})
(add-migration-id db key) (add-migration-id db key)
(is (mc/any? db coll {:_id key})) (is (mc/any? db coll {:_id key}))
(is (contains? (applied-migration-ids db) key)) (is (contains? (applied-migration-ids db) key))