On Dec 27, 2006, at 02:46, mekondelta wrote:
> I'm new to Ruby but am fairly experience in using TDD with Java and am
> having some problems in converting my knowledge over.
>
> I'm using the Eclipse Ruby plug-in and want so organise my test  
> source and
> code source files separately as I do in Java.  While I have found some
> tutorials on Ruby and they have been helpful, I have found nothing  
> on TDD
> with Ruby. Can someone point me to a small-sized ruby project that  
> I could
> download and examine which shows how a well-organised Ruby project  
> should
> look? The things I am looking for are:-
>  - Best practice in terms of code style eg variable/class naming etc
>  - interaction between class files

typical style looks something like:

modules and classes are CamelCase

other constants are UPPERCASE_WITH_UNDERSCORES

variables and method names use underscores like_this

indentation is two spaces

for files:

libs go in lib/, tests go in test/, executables go in bin/

lib/blah.rb contains class/module Blah.  A :: usually indicates a  
file in a new directory, unless the contents of the class are small.   
(Test::Unit::TestCase is in test/unit/testcase.rb.)

>  - tests in separate folders to source

The Official Test::Unit Way of Naming Test Files and Classes is:

test/test_blah.rb contains "class TestBlah < Test::Unit::TestCase"  
and tests class/module Blah in lib/blah.rb.  (Usually there isn't a  
directory hierarchy under test/, everything is flattened to  
underscores.)

Oh, and you want to run autotest which you'll find in the ZenTest  
gem.  autotest runs tests when you save your files, and figures out  
which test to run based on The Official Test::Unit Way of Naming.   
Testers find it more addictive than crack.

>  - ant build script?

We use rake and Rakefiles in ruby.  Occasionally you'll see a Makefile.

> Ideally a tutorial would be available but I'm sure the above is  
> available
> somewhere but I can't find it!
>
> Any help greatly appreciated so that I can learn Ruby the right way  
> from the
> start!

If you want to create abstract test cases use  
"undef_method :default_test" in your abstract test case to prevent it  
from complaining about no tests.

-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!