start giving it specs and tests

ChicagoBoss/ChicagoBoss#389
fix dialyzer errors and add tests

ChicagoBoss/ChicagoBoss#389