Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created July 19, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelDrogalis/e98ea7d7f16377a96c50 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/e98ea7d7f16377a96c50 to your computer and use it in GitHub Desktop.
(defmacro with-test-db [entity & body]
`(with-redefs [~entity (database ~entity test-db)]
~body))
(fact
"The job queue table has zero jobs in it to start."
(with-test-db
db/job_queue
(:size (first (persistence/queue-size 12 2)))) => 0)
[rjmdash@localhost]$ lein midje
All namespaces already :aot compiled.
FAIL "The job queue table has zero jobs in it to start." at (main_using_db_test.clj:21)
Expected: 0
Actual: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
job_queue.test.main_using_db_test$eval3684$fn__3685$fn__3686$fn__3687.invoke(main_using_db_test.clj:23)
job_queue.test.main_using_db_test$eval3684$fn__3685$fn__3686.invoke(main_using_db_test.clj:21)
job_queue.test.main_using_db_test$eval3684$fn__3685.invoke(main_using_db_test.clj:19)
job_queue.test.main_using_db_test$eval3684.invoke(main_using_db_test.clj:19)
FAILURE: 1 fact was not confirmed. (But 8 were.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment