Have you defined `$httpBackend`? See here:
http://docs.angularjs.org/api/ngMock.$httpBackend

On Thu, Jan 23, 2014 at 8:25 PM, Varun Krishna Parthasarathy <
[email protected]> wrote:

> *James Brewer,*
> I had changed the  above code to this
>
> *var $controller = $injector.get('$controller');*
>
> *        ListCtrl = function() {*
>
> *        return $controller('ListCtrl', {'$scope' : $rootScope });*
>
> *     };*
>
>  //some more code here ......
>
> *describe('it should get the  details', function(){*
>
> *     it('displays the list ',function(){*
>
> *     $httpBackend.when('GET', USERS_PATH + '/user').respond(200);*
>
> *      var controller = ListCtrl();*
>
> *     $httpBackend.flush();*
>
> *     });*
>
> *    });*
>
> But when I execute the test cases I get the following error :
>
>         *TypeError: Cannot call method 'when' of undefined*
>
> *            at null.<anonymous>
> (http://localhost:8089/base/test/unit/common/user-detail/user-detail.spec.js?1390536900000:23:20
> <http://localhost:8089/base/test/unit/common/user-detail/user-detail.spec.js?1390536900000:23:20>)*
>
> *        TypeError: Cannot call method 'verifyNoOutstandingExpectation' of
> undefined*
>
> *            at null.<anonymous>
> (http://localhost:8089/base/test/unit/common/user-detail/user-detail.spec.js?1390536900000:18:22
> <http://localhost:8089/base/test/unit/common/user-detail/user-detail.spec.js?1390536900000:18:22>)*
>
> *Chrome 32.0 (Windows): Executed 38 of 38 (2 FAILED) (3.356 secs / 1.143
> secs) *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to