Testing Private Methods
Friday, March 09, 2007 by Nate Murray.
This probably isn't news to most of you, but it might help someone. Sometimes you want to test private methods. If you want you can just set the method to be public from within a #class_eval. Then call it in your test. For example:
def test_private_method product = products(:first) # grab our fixture product.class.class_eval do public :some_private_method end assert product.some_private_method end