[rspec-users] State Based vs. Behaviour Based Spec/Testing

Scott Taylor mailing_lists at railsnewbie.com
Sun Mar 25 01:44:26 EDT 2007

Sorry if this was rather incoherent.

I guess the simplest questions that I have are these:

1.  Should you test protected and private methods in your specs?

2.  Should you ever test that a certain instance variable gets set in  
a method, or only that methods return their correct values?  This  
question can be generalized to: Should you ever test/spec *parts* of  
a method?

3.  If you already have a code base (with no specs/tests) is there  
any advantage over using Rspec to Test::Unit for verification testing?

Some of these questions may be seemingly off topic from the original  
post, but I'm sure they are connected somehow subconsciously for me.   
I'd be interested in hearing your answers.

Just another point to make:

>>> I know that Test::Unit code will always be brittle.  What happens
>>> when the code is refactored?  It is sure to break.
>> Huh? What is it about Test::Unit that makes it inherently brittle?
>> I have no idea what you are talking about here.

I was watching Dave Astel's Google Tech Talk, and one of the main  
problems he saw with testing was that classes had a one to one  
correspondence with tests, removing the ability to refactor.



More information about the rspec-users mailing list