 (with-state-changes [(before :facts (do (reset! tap/fact-counter 0)
                                         (tap/set-last-namespace-shown! nil)))]
   (fact "failure also produces not ok"
-        (tap/starting-to-check-fact test-fact)
         (innocuously :fail test-failure-map) => (contains "\nnot ok 1")))

                                        (tap/set-last-namespace-shown! nil)))]
  (fact
   "pass produces ok with the index of the test"
   (tap/starting-to-check-fact test-fact)
   (innocuously :pass) => (contains "ok 1\n")
   (innocuously :pass) => (contains "ok 2\n")))



(def test-failure-map
  {:type :some-prerequisites-were-called-the-wrong-number-of-times,
   :namespace "midje.emission.plugins.t-tap"})

(fact
 "starting a fact stream resets fact-counter and last-namespace-shown"
 (innocuously :starting-fact-stream) => ""
 @tap/fact-counter => 0
 @tap/last-namespace-shown => nil)

(fact
 "starting to check fact emits a message"
 (innocuously :starting-to-check-fact test-fact) => "# Checking named\n")

(fact
 "closing a fact stream generates the closing report"
