Using testdouble.js

testdouble.js is a test-double library written by Justin Searls and his crew at a company called Test Double. The library is very strict about the kinds of test doubles it helps you create in service of a specific pattern of testing and program design. Searls explains that in the documentation.[41]

For our purposes, the most significant part of the testdouble.js API as compared to RSpec’s mock package is that testdouble.js makes it difficult to impossible to stub only one or two methods of an exiting object. That means it’s hard to create a partial test double. In testdouble.js, the idea is that it is generally safer and clearer to replace an entire object with a test double rather than have an object exist as part test ...

Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.