Just in case it helps and because it happened to me, although it is not the exact case of the question. I had these two lines:
$httpBackend.whenGET(myService.serviceURL).respond(myMock);
$httpBackend.expectGET(myService.serviceURL);
With when
I wanted to define what to response when calling the service and with expect
I wanted to check that the method was called.
This doesn't work (although sometimes it does, I don't know why). I guess somehow expect
is overriding when
and therefore I got
Error: No response defined !
The solution was to remove the when
clause and add respond()
to expect
$httpBackend.expectGET(myService.serviceURL).respond(myMock);
I don't know why the framework behaves that way. If someone knows it would be nice that you explain it here to improve the answer