Fixes to TestCaseTest.

Same as https://github.com/rails/rails/pull/16426/files#discussion_r15977801