Fix unit tests.

Also, made tests compatible with ActiveSupport >= 3.
Remove deprecation warning.