test_watcher: fix for Ruby trunk r40195 and later
authorEric Wong <normalperson@yhbt.net>
Mon, 2 Sep 2013 09:53:51 +0000 (2 09:53 +0000)
committerEric Wong <normalperson@yhbt.net>
Mon, 2 Sep 2013 09:58:26 +0000 (2 09:58 +0000)
assert_raises doesn't capture exceptions the same way rescue works.

test/test_watcher.rb

index 5e45dcd..70e8e75 100644 (file)
@@ -154,7 +154,12 @@ class TestWatcher < Test::Unit::TestCase
     assert_equal before, headers["X-Last-Peak-At"], headers.inspect
 
     @ios << @srv.accept
-    assert_raises(Errno::EAGAIN) { @srv.accept_nonblock }
+    begin
+      @srv.accept_nonblock
+      assert false, "we should not get here"
+    rescue => e
+      assert_kind_of Errno::EAGAIN, e
+    end
     sleep 0.1
     env = @req.class.env_for "/queued/#@addr.txt"
     status, headers, body = @app.call(env.dup)