From: Daniel Berger Date: 2006-11-25T04:49:54+09:00 Subject: Generic way to test for expected SystemCallError Hi all, Ruby 1.8.x I've got a few tests where I'm looking for expected errors. These are various system call errors. The problem is that the exact Errno is different from platform to platform, so I end up writing stuff like this: assert_raises(Errno::EACCES, Errno::ENOTEMPTY){ Dir.unlink('some_dir') } This isn't very robust, since a new platform might fail with a different kind of Errno. What I would like is a way to have this test succeed: assert_raises(SystemCallError){ Dir.unlink('some_dir') } The problem is that assert_raises looks for a specific error class. Is there a way to tell TestUnit to expect any error that's a subclass of SystemCallError? Thanks, Dan PS - I see from the documentation that assert_raise is deprecated in 1.9. What's replacing it?