[LRUG] test-driven development and rails question
    Jon Wood 
    jon at blankpad.net
       
    Thu Feb 28 07:35:10 PST 2008
    
    
  
On Thu, 2008-02-28 at 15:24 +0000, Dafydd Rees wrote:
> Hello,
> 
> I've done a lot of test-driven development in Java (and a bit in a few 
> other languages too), but I find the setup in rails a bit confusing.
> 
> I want to ask people who've gotten used to the rails way of doing things:
> 
> * When rails says "unit tests" does it really mean "unit tests for models"?
>
Most of the time yes.
> * .. and does rails see functional testing as "testing one or more of 
> the controllers together"?
> 
Functional tests are for testing a single controller functions correctly
- you can use integration tests to string together several controllers,
and check the application as a whole works though.
> It looks that way to me (although I've seen the asserts for testing 
> template population in functional tests).
> 
> What if a controller gets complex enough for me to extract a few classes 
> out of it. It doesn't look like rails considers supporting those classes 
> with unit tests.
> 
There's nothing stopping you creating a unit test for those classes -
just drop it into test/unit/my_class_test.rb, and inherit from
ActiveSupport::TestCase
> Am I the only one thinking this?
> 
> Any thoughts on this appreciated.
> 
> Cheers,
> Dafydd
    
    
More information about the Chat
mailing list