Last Updated: February 25, 2016
·
474
· prototypealex

Extending modules on stubbed classes

After watching https://www.destroyallsoftware.com/screencasts/catalog/notes-on-stubbing found a seriously cool little trick for testing modules:

Stub out your class then extend the stub with the module, not only do you decouple the dependency, but it will make it über fast.

stub(customer_id: 555, something_else: 'jargon').extends(YourModule)

Stubbing ftw.