Skip to content

Instantly share code, notes, and snippets.

@stephen
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen/4e37be518dcc4231ec1b to your computer and use it in GitHub Desktop.
Save stephen/4e37be518dcc4231ec1b to your computer and use it in GitHub Desktop.
var token = null;
Session.generate({ user: 'stephen' }).then(function(result) {
session.set('expirationTime', Date.now());
token = result.token;
return session.save();
}).then(function() {
// re-fetch
return Session.load(token);
}).then(function(fetchedSession) {
// do something with the newly fetched instance
assert.equals(fetchedSession.get('user'), 'stephen');
return fetchedSession.delete();
}).done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment