Created
January 9, 2022 05:03
-
-
Save shirok/78437ba82886eb74ac11cf085d063049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- start-server [] | |
(-> (duct/resource "my_project/config.edn") | |
(duct/read-config) | |
(duct/prep-config [:duct.profile/test]) | |
(ig/init [:duct.router/ataraxy :duct.migrator/ragtime]))) | |
(def #^:dynamic the-system | |
"During the test, this var holds the initialized system map." | |
nil) | |
(defn my-fixture [test-thunk] | |
"Run the test while binding the-system to the initialized system map." | |
(binding [the-system (start-server)] | |
(try | |
(test-thunk) | |
(finally | |
(ig/halt! the-system))))) | |
(defn call-handler [request] | |
"Call the toplevel router handler" | |
(let [handler (:duct.router/ataraxy the-system)] | |
(handler request))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment