Druhie Almighty wrote: > Hi! > I guess, my problem will scarcely take you very long :) > Recently I faced with a trouble connected with creating the tests for my > program. It usually occured to be sufficient to use the methods within > the class I was testing and compare the rusult with the neccesary value > of variable or method which is used for variable. But for the current > program I need a test that would simulate the input. > In other words, for an instance let us have the following 'program': > > ### > a=0 > puts("answer is #{a+=gets.to_f}") while true > ### > > The test must input the numbers sequently and assert the equality of the > actual output with the necessary string after each step of the cycle. > So, could you please give me an example of how such tests are supposed > to be written? > I'd be very thankful for your help! Unless I haven't misunderstood something: Overwrite gets() so it outputs the required user simulation, either on system level, class level or instance level. Best regards, Jari Williamsson