How about just something like that at the end of your file;
if ENV["RUN_TESTS"]
require 'test/unit'
class MyTest < Test::Unit::TestCase
#your tests
end
end
Cheers,
Dave
On 11/15/05, listrecv / gmail.com <listrecv / gmail.com> wrote:
> Hi. I find that the best place to put unit test cases is in the file
> for the class being tested itself. This puts everything in the same
> place, and also makes examples readily available for someone trying to
> understand the code.
>
> Question 1: Can I do this without having Test::Unit automatically run
> the tests, every time the file is require 'd?
>
> Question 2: How can I do this so that RDoc shows the examples in the
> generated documentation?
>
>
>