
          }, function(resp) {
            expect(resp.error).to.be.instanceof(Error);
            expect(resp.request).to.deep.equal(request);
          });

          server.respond();

          return promise;
        });

        test('we give a useful error even when the domain doesn\'t resolve', function() {
          ajax.url = 'http://nonexistant.example.com/';
          server.restore();
          var eventFired = false;
          ajax.addEventListener('error', function(event) {
            expect