Closed ryankinderman closed 10 years ago
Ping.
I've got some other thoughts related to hooks that I'd like to run by you/work on, but want to get past this small one first.
Let me know if I can do anything to make it easier to review/accept this. Thanks!
Arg! Sorry I didn't reply sooner. Github emails were getting marked as spam!
This is interesting. I tried to add around-all when I added all the other *-all components. At the time, I concluded that around-all was either too hard or not useful, or maybe a combination of both. I don't recall the reason I left it out.
What do you use it for?
No worries; thanks for getting back to me.
We have some code that needs to reset a piece of state for the duration of the tests, but set it back afterwards. We'd like to use binding
, but without something like around-all
, we're forced to use the low-level push-thread-bindings
function in a before-all
, and then have a separate pop call in an after-all
. It's a bit awkward.
For example, right now we've got code something like this:
(describe "a feature"
(before-all
(push-thread-bindings {some-ns/*configuration* {:spanky-new-config-value 123}}))
(after-all
(pop-thread-bindings)))
But, since we'd prefer not to have to call push-thread-bindings
directly, we'd like the code to look more like:
(describe "a feature"
(around-all [context]
(binding [some-ns/*configuration* {:spanky-new-config-value 123}]
(context))))
This works great - thanks!
Any thoughts on this?