lib/subject/promiseSubject.js
function EventualSubject(subject, promise) {
  DeferredSubject.call(this);
  this.subject = subject;
  var self = this;
  this.promise = promise.then(
    function(value) {
      // Play back the recorded calls on a new subject which is created based on the resolved
      // value of the promise.
      var valueSubject = subjectFactory.newSubject(subject.failureStrategy, value);
      valueSubject.failureMessage = subject.failureMessage;
      self.run(valueSubject);
      return value;
    },
    function(reason) {
      subject.fail('Expected promise ' + subject.describe() +
        ' to succeed, but failed with ' + this.format(reason) + '.');
      return reason;
    }
  );
  // Make this object a thenable
  this.then = this.promise.then.bind(this.promise);
  this.catch = this.promise.catch.bind(this.promise);
}
function EventualSubject(subject, promise) {
  DeferredSubject.call(this);
  this.subject = subject;
  var self = this;
  this.promise = promise.then(
    function(value) {
      // Play back the recorded calls on a new subject which is created based on the resolved
      // value of the promise.
      var valueSubject = subjectFactory.newSubject(subject.failureStrategy, value);
      valueSubject.failureMessage = subject.failureMessage;
      self.run(valueSubject);
      return value;
    },
    function(reason) {
      subject.fail('Expected promise ' + subject.describe() +
        ' to succeed, but failed with ' + this.format(reason) + '.');
      return reason;
    }
  );
  // Make this object a thenable
  this.then = this.promise.then.bind(this.promise);
  this.catch = this.promise.catch.bind(this.promise);
}
A class which functions as a subject, but doesn't actually execute any assertions until
the promise has resolved. Once the promise succeeds, any method calls will be played back
on the result value of the promise.
@param {PromiseSubject} subject The subject wrapping the promise.
@param {Promise} promise The promise being tested.
@constructor
@extends DeferredSubject