fix: swap-states non string rollback
thanks to @egg-juxt for bringing it up
This commit is contained in:
parent
b77f504cfd
commit
2d050e9055
5 changed files with 18 additions and 5 deletions
2
boot.properties
Normal file
2
boot.properties
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
BOOT_VERSION=2.7.1
|
||||
BOOT_CLOJURE_VERSION=1.10.1
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(def +version+ "0.1.17-SNAPSHOT")
|
||||
(def +version+ "0.1.17")
|
||||
|
||||
(set-env!
|
||||
:source-paths #{"src"}
|
||||
|
|
@ -134,7 +134,8 @@
|
|||
|
||||
(task-options!
|
||||
tcs/test-cljs {:js-env :phantom}
|
||||
push {:ensure-branch nil}
|
||||
push {; :ensure-clean nil
|
||||
:ensure-branch nil}
|
||||
pom {:project 'mount
|
||||
:version +version+
|
||||
:description "managing Clojure and ClojureScript app state since (reset)"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(defproject mount "0.1.17-SNAPSHOT"
|
||||
(defproject mount "0.1.17"
|
||||
:description "managing Clojure and ClojureScript app state since (reset)"
|
||||
:url "https://github.com/tolitius/mount"
|
||||
:license {:name "Eclipse Public License"
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
(if-not (empty? fs) ;; (mount/start) vs. (mount/start #{}) vs. (mount/start #{1 2 3})
|
||||
(apply start fs)
|
||||
{:started #{}})
|
||||
(let [states (or (seq states)
|
||||
(let [states (or (->> states (map var-to-str) seq)
|
||||
(all-without-subs))]
|
||||
{:started (bring states up <)}))))
|
||||
|
||||
|
|
@ -294,7 +294,7 @@
|
|||
(if-not (empty? fs) ;; (mount/stop) vs. (mount/stop #{}) vs. (mount/stop #{1 2 3})
|
||||
(apply stop fs)
|
||||
{:stopped #{}})
|
||||
(let [states (or (seq states)
|
||||
(let [states (or (->> states (map var-to-str) seq)
|
||||
(find-all-states))
|
||||
_ (dorun (map unsub states)) ;; unmark substitutions marked by "start-with" / "swap-states"
|
||||
stopped (bring states down >)]
|
||||
|
|
|
|||
|
|
@ -109,6 +109,16 @@
|
|||
(is (= 42 (dval conn)))
|
||||
(mount/stop)))
|
||||
|
||||
(testing "swap-states should swap states on start and rollback on stop"
|
||||
(let [states (swap-states {#'tapp.nyse/conn swap-conn})]
|
||||
(is (= states (#'mount.core/find-all-states)))
|
||||
(mount/start #'tapp.nyse/conn)
|
||||
(is (= 42 (dval conn)))
|
||||
(mount/stop #'tapp.nyse/conn)
|
||||
(mount/start #'tapp.nyse/conn)
|
||||
(is (instance? datomic.peer.LocalConnection (dval conn)))
|
||||
(mount/stop)))
|
||||
|
||||
(testing "swap-states should swap states with states and return only states that it is given"
|
||||
(let [t-states #{"#'is.not/here" #'mount.test.composable-fns/test-conn #'tapp.nyse/conn}
|
||||
states (swap-states t-states {#'tapp.nyse/conn swap-conn
|
||||
|
|
|
|||
Loading…
Reference in a new issue