News for hackers. Stuff that matters.
Re:A routine gem update ended up creating $73k worth of subs... by antholeole on Friday January 07, 2022 @10:38PM (#29848393)
How did unit tests not catch this?
Re:A routine gem update ended up creating $73k worth of subs... by Too on Saturday January 08, 2022 @01:56AM (#29849314)
A unit test would likely have mocked the mongoid gem with the old behavior.

Integration test on the other hand…

Or Mocking one level further down, not sure about ruby but in Python there is a mongomock package which simulates most of the mongo queries in memory, so an ORM on top of raw queries does not need to be mocked. Because it simulates the database rather than just EXCPECT_CALL it’s also invariant to how you chain operations as long as end result is the same.

Re:A routine gem update ended up creating $73k worth of subs... by emodendroket on Saturday January 08, 2022 @01:33AM (#29849198)
The same answer as always, nobody thought to test this particular interaction.