Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: strategy for unit testing user input?
Kurt Walker
10/12/2007 11:06:00 PM
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-...
.
1 Answer
7stud --
10/13/2007 3:19:00 PM
0
Kurt Walker wrote:
> 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")}
>
Thanks.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: strategy for unit testing user input?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password