var chai = require("chai");
var sinon = require("sinon");
var $ = require("jquery");
var assert = chai.assert;
function saveUser(user, callback) {
$.post("/users", {
first: user.firstname,
last: user.lastname
}, callback)
}
describe('saveUser', function() {
it('should call callback after saving', function() {
//We'll stub $.post so a request is not sent
var post = sinon.stub($, 'post');
post.yields();
//We can use a spy as the callback so it's easy to verify