You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This essentially results in oldthing being reified; even if later on the cache for :thing would have been invalidated when updating some key it was originally dependent on, it won't after running this test. Having some support for this would be nice, as well as potentially a test helper for rspec like this (but that could save & restore the original proc)
(this would need to be generic as to the name of Services; I don't think this could be a method on the canister object itself though since it would need to be able to call around...?)
Similarly, if there are other issues with respect to cached values of services, test ordering can have strange results; it would be nice (even when not injecting some other dependency into a test) to have the ability to reset canister to its original state.
The text was updated successfully, but these errors were encountered:
I theory, Cannister itself could do something like this if it could just push its procs and cached values onto a stack in a faux-CPS-style, couldn't it? Maybe something like
around(:each) do |example|
Services.override do |s| # copy the procs and cached values and push onto the top of the stack
s.register(:key) { val }
s.register(:other_key) { other_val }
example.run
end # pop the stack
end
I haven't looked into the guts of Canister enough to know how hard this would be. And then there's thread safety...
It would be nice for
canister
to have the ability to reload/restore the original state. Frequently in tests I want to do something like:This essentially results in
oldthing
being reified; even if later on the cache for:thing
would have been invalidated when updating some key it was originally dependent on, it won't after running this test. Having some support for this would be nice, as well as potentially a test helper for rspec like this (but that could save & restore the original proc)(this would need to be generic as to the name of
Services
; I don't think this could be a method on thecanister
object itself though since it would need to be able to callaround
...?)Similarly, if there are other issues with respect to cached values of services, test ordering can have strange results; it would be nice (even when not injecting some other dependency into a test) to have the ability to reset
canister
to its original state.The text was updated successfully, but these errors were encountered: