Ruby's unit testing framework executes unit tests even though nobody creates unit test object. For example,
in MyUnitTest.rb
require 'test/unit'
class MyUnitTest < Test::Unit::TestCase
def test_true
assert true
end
end
and when i invoke that script as
ruby MyUnitTest.rb
test_true method gets executed automatically. How is this done?
I am trying to come up with a framework that can do similarly. I dont want "if __ FILE __ == $0" at the end of every module that uses my framework.
thanks.