Edit message: My mistake. @con_name should be $con_name and you can put $con_name in child class definition akbarhome wrote: > Hi, I have 8 class that need to be tested. They all have some same > method to be tested. So I make parent class to do the duplicate work. > > This is the parent class: > > class BaseElementControllerTest < Test::Unit::TestCase > > def setup ..<snip>... > # specific method to be tested > .... > end > > In this case, I send message to parent class using @con_name variable, > instantiated before child class definition. I have to send message > because in parent class, @controller variable must be instantiated > according to child class. So I wonder if there is another way to send > message to parent in unit testing? I try to use initialize method, but > unit testing "forbid" it. Or this is the only way to send message to > parent class in unit testing? > > Thank you.