On 23 Jan 2009, at 09:03, Francis Fish wrote:

> Forgot to mention - you can easily end up writing the code in twice  
> (as in once as a set of expectations and the second time for real)  
> if you do this, stubbing out the internals of a method. It gets a)  
> brittle and b) old very quickly and needs to be done only when you  
> really need it.

What Francis is saying is right - and the reason it would happen here  
is by modifying the internal API.  If you're specifying the behaviour  
of @thing, and also setting stubs or should_receive expectations,  
you're modifying the object you're inspecting.  In effect, you're not  
seeing the behaviour of an object of class Thing, but an object of  
another, similar, class - Thing' say - so you can't actually use those  
specs as proof that the class is correct.

If you get into a situation where you *need* to stub out private  
methods, that suggests there's another class lurking in there.

Ashley

-- 
http://www.patchspace.co.uk/
http://aviewfromafar.net/
http://twitter.com/ashleymoran




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to