On Tue, Jul 15, 2008 at 4:17 AM, Piotr W. [email protected]
How to deal with it? What is THE RSpec way to specify APIs when we face
This is more a theoretical TDD/BDD question than an RSpec question.
There are a few schools of thought about this, so I’d recommend
checking out the testdrivendevelopment list at yahoo as well - but
I’ll give you my two cents
Any subclass can override any method in the base class, so it is not
sufficient to have examples of just the base class, nor is it very
helpful to have examples for empty methods just for show if the intent
is that the base class will never get initialized directly.
If you’re deriving objects from the base class, write examples for the
derived classes. If all derived classes are intended to pass the same
examples with the same input/output expectations, then you can write
shared examples and run them against instances of all the derived
classes, thus satisfying your quest for DRY.