From: Jim Weirich Date: 2008-09-25T21:21:01+09:00 Subject: [ruby-core:18900] Re: Mini Unit changing exceptions On Sep 25, 2008, at 3:13 AM, Ryan Davis wrote: > On Sep 24, 2008, at 23:20 , Jim Weirich wrote: > >> fail RuntimeError.new("Oops") > > def fail msg = nil > msg ||= "Epic Fail!" > assert false, msg > end > > you're passing a RuntimeError instance as the message. > > fail "Oops" > > is the right way to do that. Hmmmm... It seems bad form to change the semantics of a kernel defined method. (http://ruby-doc.org/core/classes/Kernel.html#M005954) Nevertheless, it does seem to have found a weakness in my tests where I've allowed Mini::Assertions to accidently leak into the code that I'm testing. (The above was a simplified version of a real problem I ran into where the fail call was not directly in a test module and was intending to invoke the kernel version, not the mini-test version). Even so, I'm not entirely happy with the overriding of a kernel method, even if it is only in test case code. -- -- Jim Weirich -- jim.weirich@gmail.com