Fork me on GitHub
#luminus
<
2016-02-10
>
sreenath.n16:02:24

I am building an API using luminus with swagger and I am trying to use schema to validate email format (`#".+@.+"`) in the request. I am not a able to find a way to provide a custom message, incase schema validation fails… Any ideas? this is what I have now, ...`:body [user {:user {:email #".+@.+"}}]`… in the swagger route definition

chadhs22:02:35

how would one drop the test db with each lein test?

chadhs22:02:49

(use-fixtures
  :once
  (fn [f]
    (migrations/migrate ["migrate"])
    (f)))

(deftest test-messages
  (jdbc/with-db-transaction [t-conn db/conn]
    (jdbc/db-set-rollback-only! t-conn)
    (is (= 1 (db/save-message!
              {:id      1 
               :name    "Bob"
               :message "Hello World"
               :timestamp (java.util.Date.)} {:connection t-conn})))
    (is (= [{:id      1 
             :name    "Bob"
             :message "Hello World"
             :timestamp (java.util.Date.)}] 
           (db/get-messages {:id "1"} {:connection t-conn})))))

chadhs22:02:01

^ this fails as the id incs with each test run