From: Kenichi Komiya Date: 2001-03-17T10:36:04+09:00 Subject: [ruby-talk:12758] Re: assert_exception question From: Pat Eyler Subject: [ruby-talk:12754] assert_exception question Date: Sat, 17 Mar 2001 06:20:44 +0900 > Okay, I'm reading along between several docs and now I'm confused ... > I've got a method which should raise an exception, and I want to test it > using runit. Only I'm not understanding the assert_exception. From Hugh > Sasse's Docs, I read that the syntax should be: > > assert_exception(exception, message="") {block} > > Which I take to mean that I'm asserting that executing the {block} of code > will result in an exception of type 'exception' and a message with no > content. This doesn't seem to be right though. What am I missing? The message argument is the message displayed when the assertion is failed (just like the message argument of assert_equal). err = assert_exception(RuntimeError, "test01 failed") do raise("my exception"); end assert_equal "my exception", err.to_s Regards, Komiya.