I’m using dry-system to sort out dependencies for a Sinatra app (and stub them out in my tests).
Unfortunately – to the best of my understanding of my current situation, I’ll be so happy to be wrong here – a Sinatra app is a singleton. In my case
Deps is a subclass of
Dry::System::Container and I
in my Sinatra app.
In my testing suite separate tests do their own
Deps.stub('foo', fake(Foo)) /
Deps.unstub dances; unfortunately the app (being a singleton with memoized
foo result) only ever tries to opearate on the first test’s fake – the tests pass in insolation and break when ran together.
I think this is a memoization issue, because adding the below to my app solves the problem:
def foo Deps['foo'] end
– in this case the proper fakes are being fetched.
Is there an option I can pass through to dry-auto_inject to stop it from memoizing, but rather make proper
Deps['foo'] calls on every