I've found that mocking $httpBackend in unit tests is usually an indication that the system could benefit from an abstraction.
In the article's scraping example, a service that works like `Scrape.url('success.com')` could be mocked and sidestep the $http boundary with its flushing messiness. It also would make the system easier to reason about.
For more of this line of thinking take a look at the "Don't mock what you don't own" guideline which I've found very useful.
In the article's scraping example, a service that works like `Scrape.url('success.com')` could be mocked and sidestep the $http boundary with its flushing messiness. It also would make the system easier to reason about.
For more of this line of thinking take a look at the "Don't mock what you don't own" guideline which I've found very useful.