function assertDelta(delta, msg) {
  if (msg) flag(this, 'message', msg);

  let msgObj = flag(this, 'deltaMsgObj');
  let initial = flag(this, 'initialDeltaValue');
  let final = flag(this, 'finalDeltaValue');
  let behavior = flag(this, 'deltaBehavior');
  let realDelta = flag(this, 'realDelta');

  let expression;
  if (behavior === 'change') {
    expression = Math.abs(final - initial) === Math.abs(delta);
  } else {
    expression = realDelta === Math.abs(delta);
  }

  this.assert(
    expression,
    'expected ' + msgObj + ' to ' + behavior + ' by ' + delta,
    'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta
  );
}
### .by(delta[, msg])

When following an `.increase` assertion in the chain, `.by` asserts that
the subject of the `.increase` assertion increased by the given `delta`.

    var myObj = {val: 1}
      , addTwo = function () { myObj.val += 2; };

    expect(addTwo).to.increase(myObj, 'val').by(2);

When following a `.decrease` assertion in the chain, `.by` asserts that the
subject of the `.decrease` assertion decreased by the given `delta`.

    var myObj = {val: 1}
      , subtractTwo = function () { myObj.val -= 2; };

    expect(subtractTwo).to.decrease(myObj, 'val').by(2);

When following a `.change` assertion in the chain, `.by` asserts that the
subject of the `.change` assertion either increased or decreased by the
given `delta`. However, it's dangerous to use `.change.by`. The problem is
that it creates uncertain expectations. It's often best to identify the
exact output that's expected, and then write an assertion that only accepts
that exact output.

    var myObj = {val: 1}
      , addTwo = function () { myObj.val += 2; }
      , subtractTwo = function () { myObj.val -= 2; };

    expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
    expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended

    expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
    expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended

Add `.not` earlier in the chain to negate `.by`. However, it's often best
to assert that the subject changed by its expected delta, rather than
asserting that it didn't change by one of countless unexpected deltas.

    var myObj = {val: 1}
      , addTwo = function () { myObj.val += 2; };

    // Recommended
    expect(addTwo).to.increase(myObj, 'val').by(2);

    // Not recommended
    expect(addTwo).to.increase(myObj, 'val').but.not.by(3);

`.by` accepts an optional `msg` argument which is a custom error message to
show when the assertion fails. The message can also be given as the second
argument to `expect`.

    var myObj = {val: 1}
      , addTwo = function () { myObj.val += 2; };

    expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??');
    expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3);

@name by
@param {number} delta
@param {string} msg _optional_
@namespace BDD
@public