4 ms·
How did unit tests not catch this?
by antholeole 5y ago
How did unit tests not catch this?
- emodendroket 5y agoThe same answer as always, nobody thought to test this particular interaction.
- Too 5y agoA 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.