r.response).to.be.ok;
          });

          server.respond();

          return promise;
        });

        test('with rejectWithRequest the promise chain contains the request and error', function() {
          ajax.url = '/responds_to_get_with_502_error_json';
          ajax.handleAs = 'json';
          ajax.rejectWithRequest = true;

          var request = ajax.generateRequest();
          var promise = request.completes.then(function() {
            throw new Error('Expected the request to fail!');