From: Masaki Suketa Date: 2001-03-17T19:42:54+09:00 Subject: [ruby-talk:12765] Re: assert_exception question In message "[ruby-talk:12754] assert_exception question" on 01/03/17, Pat Eyler writes: > 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? assert_exception does not check message of exception. assert_exception(StandardError, "message string") { str = "No Exception" } The result is: Failures: 1 ...(TestClass): message string expected: ^^^^^^^^^^^^^^ but was: (RUNIT::AssertionFailedError) from t.rb:23 If you want to check message of exception, check return value of assert_exception. e = assert_exception(StandardError) { raise StandardError, "exception message" } assert_equal("exception message", e.message) Hope this helps. Masaki Suketa