Skip to content

Instantly share code, notes, and snippets.

@boo1ean
Created March 28, 2014 16:08
Show Gist options
  • Save boo1ean/9836394 to your computer and use it in GitHub Desktop.
Save boo1ean/9836394 to your computer and use it in GitHub Desktop.
var test = test();
var login = function(credentials) {
return test()
.post('/login', credentials);
};
var createAffiliate = test()
.post('/affiliates', casual.affiliate)
.as('affiliate')
.assert(function() {
this.res.affiliate.id.should.be.ok;
this.res.affiliate.email.should.be.equal(this.req.affiliate.email);
});
var findAffiliate = function(affiliate_id) {
return test()
.using({ id: affiliate_id })
.get('/affiliates/:id')
.as('affiliate')
.assert(function() {
this.res.affiliate.id.should.be.ok;
});
};
test()
.use(login({
username: '[email protected]',
password: 'test'
}))
.use(createAffiliate)
.use(findAffiliate('res.affiliate.id'))
.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment