My unit tests require certain setup before every fact
. It seems that the only option available that would let me define a similar behavior would be a call to before
passing :facts
, but it executes before a facts
call and before every nested fact
call and I need something that would execute exclusively before fact
calls.
Here’s an example that might help describe:
(facts "add-something"
(background (before :facts (println "before") :after (println "after")))
(fact "should add when there's something to add"
(println "1"))
(fact "should fail to add when there's nothing to add"
(println "2")))
Output:
before ; i'd like to skip the call generating this output
before
1
after
before
2
after
after ; and this last one too
But I’d like to skip the first call to (println "before")
and the last call to (println "after")
.