Rails security update

The rails upgrade also forces a mail gem upgrade. To make things work again
we need to remove part of the monkeypatched backporting of encoding fixes.
Another order dependent test issue fixed