andybons/hipchat — pull request #4 by akshayjshah (2014-01-21 01:57:47+00:00)
Title: Version 2.0: export interface, provide real and mock implementations, and add tests

This is the re-worked, leaner, meaner version of #2. It makes a few breaking changes, so it's tucked away in `/v2/`. Changes:

1. Client constructor takes a `Config` struct. This allows callers to specify just an auth token, but lets us alter the base URL in the test code.
2. Client constructor returns an interface, not a concrete type. This allows us to provide a real implementation, which is very similar to the existing client, and a mock for callers to use in tests.
3. Add a `Mock` that satisfies the `Client` interface. Callers can use the mock in their own test code.
4. Add tests for all methods on the real client and the mock. Per the built-in coverage tools, test coverage is a little over 93%.
5. Move the example into the test code, so it's compiler-verified and integrated into the docs.