Skip to content

Instantly share code, notes, and snippets.

@nicholascloud
Last active August 29, 2015 14:07
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 nicholascloud/8f8a50506cd3077b2bd1 to your computer and use it in GitHub Desktop.
Save nicholascloud/8f8a50506cd3077b2bd1 to your computer and use it in GitHub Desktop.
var mockDB = {
_data: [],
store: function (data) {
this._data.push(data);
}
};
beforeEach(function () {
// reset the mockDB every time
mockDB._data = [];
});
// the controller holds a reference to the mockDB, and will write to it
var matchController = new MatchController(mockDB);
it("holds the JSON response correctly in memory", function() {
var mockJSON = [{id: 1, name: 'spinach'}];
//...
matchController.list(function (error, response, body) {
// something like this...
expect(mockDB._data).to.include(mockJSON[0]);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment