 (defn git-add-file [state file-name file-content]
   (swap! state #(assoc % :git
                          (git-utils/git-add-file (:git %) file-name file-content)))
+  state)
+
+(defn read-channel-or-time-out [c & {:keys [timeout]
+                                     :or             {timeout 10000}}]
+  (async/alt!!
+    c ([result] result)
+    (async/timeout timeout) (throw (Exception. "timeout!"))))
+
+(defn wait-for-step-waiting [state]
+  (let [foo (:step-status-channel @state)]
+    (read-channel-or-time-out
+      (async/go
+        (loop []
+          (let [elem (async/<! foo)]
+            (if-not (= :waiting elem)
+              (recur)))))))
   state)
 
 (defn start-wait-for-git-step-with-ref [state ref]

                    (git-init)
                    (git-commit "initial commit")
                    (start-wait-for-git-step-with-ref "refs/heads/master")
                    (wait-a-bit)
                    (git-commit "other commit")
                    (get-step-result))]
      (is (= :success (:status (step-result state))))

                    (git-init)
                    (git-commit "initial commit")
                    (start-wait-for-git-step)
                    (git-commit "other commit")
                    (get-step-result))]
      (is (str-containing (commit-hash-by-msg state "initial commit") (:out (step-result state))))
