[rspec-users] [Q] how to restructure tests for an abstract class?

Chuck Remes cremes.devlist at mac.com
Mon Feb 25 07:23:24 EST 2008


Thanks for asking this question. This is exactly what I was going to  
write, but you beat me to it!

(Sorry for the top-post; just following the last responder.)

cr

On Feb 25, 2008, at 3:30 AM, Matthijs Langenberg wrote:

> Question is, would you duplicate the specs for all the classes that  
> include a certain module (through shared behaviour for example), or  
> would you use one set of specs for just the module, and specify that  
> a class should include that module?
>
> On Sun, Feb 24, 2008 at 12:19 AM, Pat Maddox <pergesu at gmail.com>  
> wrote:
> On Thu, Feb 21, 2008 at 8:09 AM, Chuck Remes  
> <cremes.devlist at mac.com> wrote:
> > While practicing BDD on my first-ever BDD project, I have come to a
> >  point where it makes sense to change my original class to an  
> abstract
> >  class and create one (or more) concrete subclasses that implement a
> >  specific method. What is the right way to restructure the tests in
> >  this scenario? Do I leave the existing tests in place and just  
> create
> >  a new spec file that instantiates and tests the concrete subclass?
> >
> >  I think I can continue to instantiate my "abstract" parent as  
> long as
> >  I don't go near the behavior that will be defined by the concrete
> >  subclasses. Is that the right thing to do?
> >
> >  Thanks for any hints.
> >
> >  cr
> >  _______________________________________________
> >  rspec-users mailing list
> >  rspec-users at rubyforge.org
> >  http://rubyforge.org/mailman/listinfo/rspec-users
> >
>
> I think that shared example groups might be useful.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080225/74385466/attachment-0001.html 


More information about the rspec-users mailing list