Hacker News new | ask | show | jobs
by antholeole 1627 days ago
How did unit tests not catch this?
2 comments

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.

The same answer as always, nobody thought to test this particular interaction.