The reason for this is simple. If you want to stub out some method, you have to do it very precisely. You have to know the underlying implementation and choose a very concrete instance and method for stubbing. This makes your test very tightly coupled to the implementation details of tested class. And tightly coupled is brittle. Let’s look at some trivial example:
Category Archives: coupling
Looking for an easy way to manage agile project?
- Hash bars - simple ASCII-art charts in your console, database or Excel
- Easy and flexible breadcrumbs for Rails
- A simple shuffle that proved not so simple after all
- Does stubbing make your tests brittle?
- Cookie handling in multi-domain applications in Ruby on Rails
- Blast from the past: Compaq commercials with John Cleese
- Self-referential many-to-many relations in Ruby on Rails
- The endless cycle of code vs docs
- 265,156 hits