fix occasional travis-ci spec failures
fix occasional travis-ci spec failures

by backport of a change in the Rails 5.2 PR.
ophrescue/RescueRails,ophrescue/RescueRails,ophrescue/RescueRails,ophrescue/RescueRails