[rspec-users] rspec and testing IO

2011-09-08 Thread Justin Beck
8 Sep 2011 17:03:50 -0400 > From: Justin Beck > To: rspec-users@rubyforge.org > Subject: [rspec-users] rspec and testing IO > Message-ID: <50e4d18c-3f36-4707-82f1-6166afb77...@mac.com> > Content-Type: text/plain; CHARSET=US-ASCII > > I have a class that expects some inp

Re: [rspec-users] rspec and testing IO

2011-09-08 Thread Justin Ko
On Thu, Sep 8, 2011 at 3:03 PM, Justin Beck wrote: > I have a class that expects some input via 'gets'. I found that, when > testing, I can do something as simple as this: > > @foo.stub!(:gets) { "stuff\n" } > > However that only works in the most simple case. In my case the class asks > a seri

[rspec-users] rspec and testing IO

2011-09-08 Thread Justin Beck
I have a class that expects some input via 'gets'. I found that, when testing, I can do something as simple as this: @foo.stub!(:gets) { "stuff\n" } However that only works in the most simple case. In my case the class asks a series of questions that require a yes/no answer culminating in som