State-Passing Fixtures (Setup/Teardown Context)
veritas-365Veritas allows #:before and #:after hooks that accept a context (vc). To make these incredibly powerful, ensure that hooks can transform and pass state cleanly into the tests.
The Improvement: If a #:before hook sets up a temporary database connection or a mock file descriptor, it should return that resource wrapped in the context, which is then cleanly passed as an argument directly into the test thunks.
How it looks:
Scheme
(test "Read from temp DB"
#:before (lambda (vc) (setup-mock-db)) ; returns db-conn
(lambda (db-conn) ; test body accepts the fixture
(assert-true (db-active? db-conn))))
plan (0)
time logged (0)
no time logged yet
discussion (0)
no comments yet
attachments (0)
no attachments yet
activity (0)
nothing recorded yet
versions (0)
no versions yet
