Open kwstannard opened 4 months ago
@kwstannard I understand the issue and what you're trying to achieve. However, this isn't something WebMock is designed to handle. WebMock uses global registries in the current process's memory and doesn't differentiate between main and subprocesses. The behaviour you're seeing is correct given how forking works.
Here are some ideas on how you could solve that:
Thanks bblimke.
I think this is maybe a feature request. WebMock matchers do not work with forking. This makes sense logically given that a web request will change the stub object and trigger copy-on-write. It would be great if there was a way to have the copied stub in the fork send back the recorded requests to the main process stub though.
Ruby 3.3.3 WebMock 3.23.1