Improve code quality a bit

CodeClimate had some things to say about a couple of methods.

I added tests for them, and tried to fix some of the issues.

* The mailer (Notifier) now actually has tests.
* The mailer got a major refactoring.
* Purchase.payable_grouped_by_person now has tests, and is a bit less messy.