Open holyjak opened 10 years ago
One of the core ideas of Midje is that its expressions (facts, =>, whatever) are really just ordinary Clojure code, run in sequence with whatever code surrounds them. From that point of view, it's unsurprising that setup
runs as expected. What's surprising is that there's a "magic" mechanism that runs code invisibly before or around facts.
There are two things that need to be fixed:
The current documentation doesn't make it clear that this is legal:
Contrary to the standard setup/teardown solution of
with-state-change
, this makes it possible to run the setup only once for a group of facts, which is desirable if the setup is expensive. (And I guess we could get teardown by wrapping the facts in try-catch and running the teardown code in finally)). It would be nice to describe this on the https://github.com/marick/Midje/wiki/Setup-and-teardown page. If this is not a recommended practice, what would be the optimal solution?