From: Daniel Schierbeck Date: 2007-02-17T23:20:35+09:00 Subject: Re: [Test::Unit] Asserting exception messages? On Sat, 2007-02-17 at 06:17 +0900, Eric Hodel wrote: > On Feb 16, 2007, at 11:36, Daniel Schierbeck wrote: > > > I've been looking around, but I haven't found a simple way of > > asserting > > that a raised exception has a specific message. RSpec can do this > > quite > > easily: > > > > lambda{ @fixture.foo }.should_raise(FooError, > > 'out of foo, try our delicious bar instead!') > > So does Test::Unit. > > e = assert_raise BlahError do ... end > assert_equal 'something', e.message Very nice, didn't think about checking the return value! Thanks!