I am trying to stub a class method. The method has multiple calls to 'gets'. I wanted to manually return specific values to 'gets' calls. My code is similar to this -
ParseAndPlay.stub :gets, {***NEED SOMETHING HERE***} do
ParseAndPlay.run
end
and ParseAndPlay.run expects
def ParseAndPlay.run
gets #=> expects "5 5"
gets #=> "1 1 N"
gets #=> "MMM" ... and so on
end
Can this be done by just using minitest?
I ended up changing the class that was being tested. Called a new function 'get_input' which then called 'gets' and then stubbed the 'get_input' method.