[3.1] Fix test failure for ruby 1.8

ref https://github.com/rails/rails/pull/9208#issuecomment-13290985