From: Robert Feldt Date: 2006-05-15T19:53:19+09:00 Subject: Re: Testing private methods On 5/15/06, Peter Hickman wrote: > Thank you that looks to be just what I need. > Since this is a bit "unsafe" (considering that some dev might use your tests as a kind of API/code doc and might miss that they are private or whatever) I tend to test my private methods in a separate TestCase and/or name the test methods accordingly to make this "unsafeness" clearer to the reader. Example: require 'test/unit' class ClassUnderTest public :priv1, :priv2 end class UnitTest_PrivateMethods_ClassUnderTest < Test::Unit::TestCase def test_01_private_priv1 end # ... end class UnitTest_ClassUnderTest < Test::Unit::TestCase # "normal" tests goes here end Not sure if it really works but anyway... I find the obj.send(:priv_method) technique a bit too cumbersome to write if there are many tests. Regards, Robert