From: Jeremy Kemper Date: 2007-03-07T13:12:44+09:00 Subject: Re: Mocha raise exception first call, return value second call ------=_Part_181806_31533034.1173240759121 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 3/6/07, Raymond O'Connor wrote: > > Is there a way to have mocha raise an exception the first time an stub > is called, and then return a value the second time it is called? > > First example, I'm trying to connect to a server and test the case where > my first attempt raises a 'Server busy' exception or something of that > sort. So I wait, then retry and then the second time the connection is > successful. server.expects(:connect).returns do server.expects(:connect).returns(true) raise Busy end Hackish? Unclean? ;-) jeremy ------=_Part_181806_31533034.1173240759121--