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.
Written by Alex Gibson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#