Bump Rails to 3.1.12.

Also pin down the Mocha version to avoid potential dependency problems.