From: Kurt Walker Date: 2007-10-13T08:06:20+09:00 Subject: Re: strategy for unit testing user input? 7stud -- wrote: > Hi, > > I have a program that prompts the user on the command line to enter some > data. What are some ways to unit test the method that obtains the > input? I'm not sure if you found an answer to this. I came across your post when I was looking for an answer to the same thing. The best way I found is to use flexmock (or other mock tool). flexmock($stdout){|mock| mock.should_receive("puts").with("enter something")} flexmock($stdin){|mock| mock.should_receive("gets").and_return("junk")} -- Posted via http://www.ruby-forum.com/.