README.textile

nest-unit

Simple nested contexts for Test::Unit.

Usage

require 'test/unit'
require 'nest-unit'
class FooTest < Test::Unit::TestCase
test "should be true" do
assert true
end
context "when there is a thing" do
before do
@thing = Object.new
end
test "bar-ing" do
assert Foo.bar(@thing)
end
test "fizz-ing" do
assert Foo.fizz(@thing)
end
context "when there are two things" do
before do
@another_thing = Object.new
end
test "bar-ing" do
assert Foo.bar(@thing, @another_thing)
end
test "fizz-ing" do
assert Foo.fizz(@thing, @another_thing)
end
after do
Foo.some_more_cleanup!
end
end
after do
Foo.cleanup!
end
end
end

Helper Methods

If you need to define helper methods for your tests, use the helper helper: