views:

48

answers:

1

I need to unit test that an exception in raised in code like:

def test
    assert_raise Timeout::Error do
      Thread.new {
        raise  Timeout::Error
      }
    end
  end

How to get this working?

+1  A: 

in the assert_raise block:

t = Thread.new { raise Timeout::Error }
t.join
ReinH