Example #1
0
  it_('Delete driver by user id', function * () {
    var attrs = {
      userId: SeedObj.user5Id.user_id,
      location: { lat: 30.263619, lng: -97.737909 },
    };
    var driver = yield Ride.createDriver(attrs);
    assert.typeOf(driver, 'object');
    assert.equal(driver.foreign_driver, SeedObj.user5Id.user_id);

    yield Ride.deleteDriver(SeedObj.user5Id.user_id);
    var getDeleted = yield Ride.getDriverById(SeedObj.user5Id.user_id);
    assert.equal(getDeleted, undefined);

    // nice!
  });
Example #2
0
RideAPI.delete('/drivers', function (req, res) {
  var id = req.body.user_id;
  Ride.deleteDriver(id)
    .then(sendStatus(res, 204))
    .catch(sendStatusAndError(res, 500, 'error deleting driver'));
});