On Sat, Aug 2, 2008 at 8:10 AM, Mikel Lindsaar <raasdnil at gmail.com>
wrote:> Heya all,
>
> I have an interesting case that I would like to bounce off the list.
>
> I have a separate thread going in ruby-talk about Timeout.timeout
> still running after the timeout specified. The spec on this has been
> the classic ''I didn''t write it, so I won''t spec
it'' and so using mocks
> and stubs.
>
> But in this case I am getting a failure (it seems) in the Timeout
> library or in the OCI8 library maybe... I actually don''t know.
>
> But regardless, how would one go about specing a timeout block?.....
> _without_ having to wait 2000 seconds? :)
The first thing that comes to mind is to pass in your timeout
threshold as a defaulted argument, ie: def do_something(timeout=2000),
and then in the example pass in a much lower threshold. This assumes
that you want the block you pass to timeout to actually be executed.
--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com