tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

start-with params should be [with & states] #80

Closed mnewt closed 7 years ago

mnewt commented 7 years ago

I'm using start-with in my tests to override development settings. In the test context, I want to start part of my application. I can't do that with start-with--it starts everything. I want to do this:

(use-fixtures
  :once
  (fn [f]
    (let [prev-states (mount/stop)]
      (mount/start-with
        {#'app.config/env test-env}
        #'app.db.core/*db*)
      (f)
      (mount/stop)
      (apply mount/start prev-states))))

Should I do something different or is that the best approach? I tried using args but that seems inelegant. If that's the best approach, do you want a pull request? Seems like an easy change.

tolitius commented 7 years ago

you can compose mount functions: https://github.com/tolitius/mount#composing-states

i.e.

(-> (only #{#'app.db.core/*db*}
    (swap {#'app.config/env test-env})
    mount/start)
mnewt commented 7 years ago

Oh, right... Sorry I missed that and thanks for being awesome!