Add compatible between minitest 4 and 5

like:
Ensure backward compatibility between Minitest 5 and 4 by robin850
Pull Request #13505 rails/rails
https://github.com/rails/rails/pull/13505