marick/Midje — pull request #237 by JacekLach (2013-08-26 20:16:59+00:00)
Title: JUnit output breaks compatiblity (`deftest`-wrapped) forms executed via `lein test`

```
(ns midje-breakage.core-test
(:require
[clojure.test :refer [deftest]]
[midje.sweet :refer [facts fact =>]]))

(deftest spam
(fact "It's not ham" "spam" => "spam"))
```
```
$ lein test

lein test midje-breakage.core-test

lein test :only midje-breakage.core-test/spam

ERROR in (spam) (core.clj:2178)
Uncaught exception, not in assertion.
expected: nil
actual: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom
at clojure.core$reset_BANG_.invoke (core.clj:2178)
midje.emission.plugins.junit$starting_to_check_fact.invoke (junit.clj:77)
clojure.lang.Var.invoke (Var.java:415)
clojure.lang.AFn.applyToHelper (AFn.java:161)
clojure.lang.Var.applyTo (Var.java:532)
clojure.core$apply.invoke (core.clj:617)
midje.emission.api$bounce_to_plugin.doInvoke (api.clj:32)
clojure.lang.RestFn.invoke (RestFn.java:423)
midje.emission.api$starting_to_check_fact.invoke (api.clj:77)
midje.checking.facts$check_one.invoke (facts.clj:30)
midje.checking.facts$creation_time_check.invoke (facts.clj:35)
midje_breakage.core_test/fn (core_test.clj:7)
clojure.test$test_var$fn__7145.invoke (test.clj:701)
clojure.test$test_var.invoke (test.clj:701)
user$eval83$test_var_with_selector__92.invoke (NO_SOURCE_FILE:1)
clojure.lang.AFn.applyToHelper (AFn.java:163)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:619)
leiningen.core.injected$compose_hooks$fn__17.doInvoke (NO_SOURCE_FILE:1)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:617)
leiningen.core.injected$run_hooks.invoke (NO_SOURCE_FILE:1)
leiningen.core.injected$prepare_for_hooks$fn__22$fn__23.doInvoke (NO_SOURCE_FILE:1)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.test$test_all_vars$fn__7149$fn__7156.invoke (test.clj:717)
clojure.test$default_fixture.invoke (test.clj:671)
clojure.test$test_all_vars$fn__7149.invoke (test.clj:717)
clojure.test$default_fixture.invoke (test.clj:671)
clojure.test$test_all_vars.invoke (test.clj:713)
clojure.test$test_ns.invoke (test.clj:736)
clojure.core$map$fn__4207.invoke (core.clj:2487)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.boundedLength (RT.java:1654)
clojure.lang.RestFn.applyTo (RestFn.java:130)
clojure.core$apply.invoke (core.clj:619)
clojure.test$run_tests.doInvoke (test.clj:751)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:617)
user$eval83$fn__149.invoke (NO_SOURCE_FILE:1)
user$eval83.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6609)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$eval_opt.invoke (main.clj:308)
clojure.main$initialize.invoke (main.clj:327)
clojure.main$null_opt.invoke (main.clj:362)
clojure.main$main.doInvoke (main.clj:440)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:419)
clojure.lang.AFn.applyToHelper (AFn.java:163)
clojure.lang.Var.applyTo (Var.java:532)
clojure.main.main (main.java:37)

Ran 1 tests containing 1 assertions.
0 failures, 1 errors.
Tests failed.
```

It seems `starting-fact-stream` is not called before `starting-to-check-fact` is.

`lein midje` still works.