From b19f7b78252b652c4fdbe39bca5c0042192a0da8 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Fri, 14 Feb 2014 16:29:40 -0700 Subject: [PATCH] Fixed a broken test --- test/unit/browser_builds/angular.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/browser_builds/angular.js b/test/unit/browser_builds/angular.js index 7a512fffb..8440d9a6a 100644 --- a/test/unit/browser_builds/angular.js +++ b/test/unit/browser_builds/angular.js @@ -11,6 +11,7 @@ describe('Angular esFactory', function () { var uuid = (function () { var i = 0; return function () { return ++i; }; }()); function directive(makeDirective) { var root = document.createElement('div'); + root.setAttribute('ng-controller', 'empty-controller'); var id = uuid(); root.setAttribute('test-directive-' + id, 'test-directive'); document.body.appendChild(root); @@ -20,7 +21,11 @@ describe('Angular esFactory', function () { root = null; }); - angular.module('mod' + id, ['elasticsearch']).directive('testDirective' + id, makeDirective); + angular + .module('mod' + id, ['elasticsearch']) + .controller('empty-controller', function () {}) + .directive('testDirective' + id, makeDirective); + angular.bootstrap(root, ['mod' + id]); } @@ -60,10 +65,11 @@ describe('Angular esFactory', function () { directive(function (esFactory) { return function () { var client = esFactory({ hosts: null }); + client.get().then(function () { expect.fail('promise should have been rejected'); }, function (err) { - expect(err.message).to.match(/unable/); + expect(err.message).to.match(/unable/i); done(); }); };