[rspec-users] raise_error suggestion

rogerdpack rogerdpack at gmail.com
Wed Apr 14 15:28:11 EDT 2010

I remember reading a post where somebody mentioned something like

"sometimes after a refactoring, a test block like

     lambda { ... }.should raise_error

catches a NoMethodError in error, thus is actually failing, but the
user isn't notified of the same."

A suggestion in this regard:
change it so that if raise_error is called without parameters, and it
catches NoMethodError, it outputs a warning somehow.

The objection to this might be "what if I *expect* a NoMethodError--
I'll get spurious warnings"

Answer: user can, at that point, put in NoMethodError as a parameter,
and warning goes away (and that's a rare enough case that it probably
won't cause conflicts).


More information about the rspec-users mailing list