Adding tests and fixing a bug in the view's error handling.
Merge pull request #3 from adamcharnock/feature/tests

Adding tests