ring-swagger

ring-swagger & compojure-api
mgrbyte 2018-01-24T15:36:17.000884Z

Wondering how folks are testing apps that use compojure-api + datomic. Currently: have middleware that adds datomic and conn and db to the request; using datomock and clojure.core/with-redefs in tests to simulate using [1] as guide. Does this sound reasonable or is there a better way to do it? ([1]: http://vvvvalvalval.github.io/posts/2016-07-24-datomic-web-app-a-practical-guide.html#forking_database_connections). Thanks!

mgrbyte 2018-01-25T10:08:28.000116Z

@csm Doing something similar with mount/start-with, but only the connection is passed in. Is the component system started for each request, or on "server start" (e.g ring init handler)

csm 2018-01-25T16:46:41.000261Z

only on server start, and we do that in use-fixtures :each, so itโ€™s a new DB and new server for each test

mgrbyte 2018-01-25T21:14:13.000468Z

@csm ah. I want to obtain a new DB value on each request, so passing in on server start not an option :thinking_face:

csm 2018-01-24T19:02:08.000020Z

We wrote a testing library that spins up a datomic DB using mem storage, and then starts the service (via com.stuartsierra.component) with the temp DB passed into the system. We do this for each test with use-fixtures, initializing the schema and test data each run.

๐Ÿ‘ 1