copy mock patches from 1aed21b for Rails edge (5)