Skip to content

Instantly share code, notes, and snippets.

@ChrisC
Created January 10, 2014 01:38
Show Gist options
  • Save ChrisC/8345530 to your computer and use it in GitHub Desktop.
Save ChrisC/8345530 to your computer and use it in GitHub Desktop.
it('should set the offer to accepted when a carrier accepts on a drivers behalf', function (done){
new StateImporter('offers', 'accept', function () {
models.user.findOne({_type : 'Driver'}, function (driver) {
models.offer.findOne({}, function (offer) {
var accept_offer = function (callback) {
request.put('/api/1/offers/accept')
.send({driver_id : driver._id, offer_id : offer._id, accept : 'true', by_proxy : 'true'})
.end(function(err, res) {
callback(null, res.body.jobs);
});
};
async.parallel([accept_offer, accept_offer], function (err, result) {
_.compact(result).should.have.lengthOf(1);
done();
} );
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment