[rspec-users] How to write specification for the *base* class API?

Bart Zonneveld loop at superinfinite.com
Tue Jul 15 10:16:20 EDT 2008

On 15-jul-2008, at 15:22, Piotr Wlodarek wrote:

>>> However, since we deal with a base class, methods are often empty
>>> (put there just to show the API).
>> What's the point of that?  This isn't Java.
> Documentation for developers of derived classes.
>> Exactly. In all of my projects, I only have an inheritance tree of
>> at most 3 levels deep.
> It's not AR. I have 2 levels: Site1Scraper < BaseScraper.

Ok, but if a method is only in a BaseScraper for documentational  
purposes, eg, an empty body, should it be defined on that model at  
all? If it's only going to be used on a Site1Scraper, leave it to  
that class to define and have it tested there.
As far as I know there's no useful implementation of an interface or  
an abstract class in ruby, but I could be wrong.

> There will be many SiteXScrapers implemented by several people.
> ++++
>> From your answers I conclude it's not possible (or at least not
> recommended) to document abstract interface with RSpec.

More information about the rspec-users mailing list