Test case for rails#14784