Created
March 28, 2014 16:08
-
-
Save boo1ean/9836394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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