Ensure test compatibility with Rails 3.2.x/4.0.x/4.1.x

As I started looking into (some other) bug, I first found I couldn't run the tests because of some recent Rails internals restructuring.

A couple of commits here that get me back to the point where I get green tests on Rails 3.2.x, 4.0.x and 4.1.x

NB: I pulled in \#40 as part of the pull request