I'm not sure if it's a good approach, but I think it will do for now.
/cc @pspacek, though I guess you've forgotten most of this test since 1df45b3e.