blainsmith/node-automatic — pull request #4 by flochtililoch (2014-02-08 19:56:03+00:00)
Title: Fix token expiration

`expires_in` property of returned token represents a number of seconds (valid ~1 year), while current implementation assumes a unix timestamp.
Because of this assumption, following code:
```javascript
(this.token.expires_in > new Date().getTime(); // expires_in == 31535999
```
will always return false.

This PR:
* add reference to current date before requesting token.
* use this reference when checking if token is valid.
* fix mocked value for expires_in in test.
* add test to make sure the token actually expires.