Fix 3-1-stable to work with Mocha >= v0.13.0

Backport of #8200. The equivalent of 17ccefc4360caea1a80eada324513dc6cb809c75 by @carlosantoniodasilva would fix Mocha deprecation warnings in Rails tests.