and to test the private method blah of a class Foo
class Class
def publicize_methods
saved_private_instance_methods = self.private_instance_methods
self.class_eval { public *saved_private_instance_methods }
yield
self.class_eval { private *saved_private_instance_methods }
end
end
class TestFoo &Test::Unit::TestCase
def test_blah
Foo.publicize_methods do
assert_not_nil Foo.blah
end
end
end
and thats it... :)