testdouble / mocktail

šŸ„ƒ Take your Ruby, and make it a double!
https://rubygems.org/gems/mocktail
MIT License
274 stars 10 forks source link

Ensure that type replacements are threadsafe #6

Closed al2o3cr closed 2 years ago

al2o3cr commented 2 years ago

Modifying a Hash from multiple threads is potentially dangerous, even if threads don't access the same key.

To avoid this, make Mocktail::TopShelf a thread-local singleton.

The list of type replacements corresponds to global changes, so those are represented as a class variable and wrapped in a Mutex.

searls commented 2 years ago

Looks fantastic, this is a huge improvemntā€”thank you!!

searls commented 2 years ago

landed in 0.0.5