0

In an application I'm writing, we possibly fire more than 1 request (based on some preconditions) upon doing certain actions in the UI. I'm trying to write this in a test, but I'm finding a hard time trying to mock the request: if the request gets fired more than once, I each time get:

Error: Unexpected request: PUT my/test/url
    No more request expected 

Is there any way to have the mocked httpbackend respond to a request multiple times? (kind of like you could state in a Mockito verify how many times the action should be done on the mock)

gjoris
  • 1,731
  • 2
  • 17
  • 22
  • A workaround for my specific problem is an expect with different data -- which, ofcourse, is quite evident. But still, I'll leave this question up, because I'm fascinated if there is a way to mock the same request multiple times. – gjoris Oct 14 '13 at 08:53
  • Yep, flush statement is present. – gjoris Oct 16 '13 at 13:04
  • Possible duplicate of [Mocking $httpBackend - how to handle "Unexpected request, No more request expected"?](http://stackoverflow.com/questions/22405085/mocking-httpbackend-how-to-handle-unexpected-request-no-more-request-expect) – Paul Sweatte Dec 14 '15 at 01:36

0 Answers0