From: "Jesús Gabriel y Galán" Date: 2010-03-25T19:36:51+09:00 Subject: Re: Unit Testing : line by line ? On Thu, Mar 25, 2010 at 10:37 AM, onion wushu wrote: > Hi everybody ! > > I would like to verify some properties in a method, line by line. For > example: > > class Hello >  def initialize >    @a = "hi !" >  end > >  def say_hi >    @b = "hi !" >    # checking here >    @b = "hello !" >    # another checking here >  end > end > > We could imagine that we would like to verify the properties @a==@b > after the first declaration of @b and after the second one. Is there a > way to handle this case with TestUnit ? Any other suggestions ? The minimal unit for unit testing is a method. If you find the need to unit test a part of the method that could be a sign that the method is too complex and you should refactor it: def say_hi process_some_stuff("hi!") process_other_stuff("hello!") end def process_some_stuff(value) @b = value end def process_other_stuff(value) @b = value end and you can unit test process_some_stuff and the other extracted methods individually. Jesus.