Better HN
topnewbestaskshowjobs
Log inSign up

eeeschwartz

4 karma · joined Jan 2, 2013 (13y ago) · 2 submissions

Submissions

comment 12y ago · link · parent

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.

2.

Pragmatic Flight of Fancy in Rails Testing(tablexi.com ↗)

1 points · by eeeschwartz · 13y ago · discuss