From: James Byrne Date: 2006-02-23T06:14:09+09:00 Subject: Re: FILE test Adam Shelly wrote: > So what is the 'ruby way' to store your unit tests? A separate > require'd file? Well, going by the Pickaxe book you end up with something like this: ./classfilename ->/doc ->/lib ->/test in ./classfilename/lib you create your ruby source file classfilename.rb in ./classfilename/test you create your ruby test/unit file classfilename_tc.rb In classfilename_tc.rb you put the following lines at the start: #---------------------------------------------------------------- # The following prefixes ../lib to the active ruby load path $:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'classfilename' class Test_ClassFileName < Test::Unit::TestCase ... #---------------------------------------------------------------- and then write your test cases as methods. When you run your test suite you can invoke it from any palce on the system as the #unshift prefixes the load path with the relative location of the classfilename.rb with respect to the test case file. Thus, assuming that for the example given above that ./ = ~/ruby then: #ruby -w ~/ruby/classfilename/test/classfilename_tc.rb will work whatever pwd you are in. I love test/unit... Regards, Jim -- Posted via http://www.ruby-forum.com/.