[rspec-users] Specing protected methods
Matt Wynne
matt at mattwynne.net
Thu Oct 23 06:37:28 EDT 2008
On 23 Oct 2008, at 10:16, Bastien wrote:
> Hi everyone,
> Do anyone know if there's a way to spec protected methods ?
> Thanks in advance
Sorry if this sounds preachy, but I would always advise you to factor
out the code in the method into another class, then test that class.
If the behaviour of the method is so complex you need to test it on
it's own, it deserves to be in a class all by itself.
This is what we call, 'listening to your specs' - if it's hard to
spec, you've probably got the design wrong.
HTH,
Matt
More information about the rspec-users
mailing list