[rspec-users] Monitor method invoking from superclass
wagner.andrew at gmail.com
Thu Sep 30 11:17:07 EDT 2010
Rick, could you elaborate on this? I'm curious, how would you use a shared
example group here, given his sample code?
My first thought was to use ancestors to get the parent class, and re-define
the 'a' method there to do something simple and observable, and then test
that. Is that evil?
On Thu, Sep 30, 2010 at 11:00 AM, Rick DeNatale <rick.denatale at gmail.com>wrote:
> On Thu, Sep 30, 2010 at 10:36 AM, Zhi-Qiang Lei <zhiqiang.lei at gmail.com>
> > On Sep 30, 2010, at 9:56 PM, Rick DeNatale wrote:
> >> What you really should be testing that the observable effects of the
> >> call are 'as if' the super call were made.
> >> If you could test that the super call was made it would be testing
> >> that the implementation were a certain way more than the behavior of
> >> the object, and that's the road to writing brittle tests.
> > In my case, there is already a test case for the method in class A, and
> its feature is complex. So I was trying to test the super call but
> observable effect for simple. Anyway, thank you both.
> That's what shared example groups are for.
> Rick DeNatale
> Blog: http://talklikeaduck.denhaven2.com/
> Github: http://github.com/rubyredrick
> Twitter: @RickDeNatale
> WWR: http://www.workingwithrails.com/person/9021-rick-denatale
> LinkedIn: http://www.linkedin.com/in/rickdenatale
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users