Tests for HABTM

Dug up this branch while pruning. I think I was convinced that replicate wasn't correctly handling HABTM, then in the course of writing tests realized that I was just doing it wrong. Still, if you want some tests for HABTM, here you go.