Tests overhaul

I've gone through the failing specs and either:

* Fixed them
* Removed them
* Marked them as pending

Specs that were removed seemed to be obsolete for one reason or another (e.g. referenced non-existent models, had no tests beyond the generated skeleton) whereas specs marked as pending are mostly good but need fundamental changes to get working again.

The goal of this PR is to get the test suite passing so that new functionality can have tests written for it. There is a lot of backfilling that still needs doing if we want full test coverage, and we'll need new issues to fix the pending tests.