RubyUnit - A simple testing framework for Ruby
RubyUnit is a simple Ruby testing framework developed by Masaki Suketa. Like Junit, RubyUnit requires your test cases to extend from RUNIT::TestCase. The license under which it is release is same as that of Ruby.
You can download RubyUnit from here.
Following is a sample RubyUnit test case code,
require 'rubyunit'
class SimpleTest < RUNIT::TestCase
def setup
@fval1 = 2.0
@fval2 = 3.0
end
def test_add
result = @fval1 + @fval2
assert(result == 6.0)
end
def test_divide_by_zero
zero = 0
result = 8 / zero
end
def test_equals
assert_equal(12, 12)
assert_equal(12, 13)
end
def test_match
assert_match(/foo/, 'foobar')
assert_match(/foo/, 'barbaz')
end
end