[rspec-users] rspec testing inheritance

Matt Wynne matt at mattwynne.net
Wed Sep 7 08:03:07 EDT 2011


On 7 Sep 2011, at 07:53, Sidu Ponnappa wrote:

> 
> On 7 September 2011 11:09, Justin Ko <jko170 at gmail.com> wrote:
>> 
>> 
>> On Tue, Sep 6, 2011 at 9:40 PM, slavix <mikerin.slava at gmail.com> wrote:
>>> 
>>> Hello,
>>> Is there any way to test model inheritance in spec?
>>> 
>>> something like..
>>>  it { ChildModel.should < ParentModel }
>>> 
>>> thanks.

> Wouldn't this be an implementation bound spec?

+1

Test the behaviour, not the implementation. You could look at using a shared example group if you want to specify that the subclass shared behaviour with the superclass.

--
Freelance programmer & coach
Author, http://pragprog.com/book/hwcuc/the-cucumber-book (with Aslak Hellesøy)
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne



More information about the rspec-users mailing list