Add unit tests

Closes #42
It can, and should. I was trying to avoid changing too much code. I might even undo the `spec` -> `spec_location` change, and do it in another PR.