Spec'ing correct use of Timeout

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? :slight_smile:

Mikel

On Sat, Aug 2, 2008 at 8:10 AM, Mikel L. [email protected]
wrote:

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? :slight_smile:

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 D.
http://www.continuousthinking.com