[rspec-users] How to write specification for the *base* class API?
dchelimsky at gmail.com
Tue Jul 15 09:51:42 EDT 2008
On Jul 15, 2008, at 8:22 AM, Piotr Wlodarek <lists at ruby-forum.com>
>>> 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.
> 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.
If everyone gave up that easily we'd never improve anything ;)
Not sure how you get to "not possible." Pat suggested shared examples,
which would be a perfectly good solution for part of the problem.
I think the question is what are you trying to acheive here and
whether Rspec (or any testing framework) is the right place for that
More information about the rspec-users