Fixed broken middleware tests

https://travis-ci.org/rails/rails/builds/9082898