Refactoring and cleanup

- Added docstrings to the tests
- Added an expected SPEC file
(I was doing it wrong earlier)
- Use substitute() instead of safe_substitute() for
  the template string