is trying to tell me my map/reduce function is pointed at some collection that doesn’t exist. This would be extremely unlikely to show up on a development environment of course – but on our CI server (we use CircleCI, and I’m loving it) the test DB is created every run, and so we enjoy intermittent failures, dependent on test order.

The solution

I added some indices to the Mongoid::Document that was giving me the hairloss, then ran..

When I run an offending test again, all is right in the world. I hope this helps someone - this was one hell of a frustrating problem. There’s not much joy in a failing build after having worked so hard on a test driven workflow locally.