[rspec-users] no should raise_exception

Ashley Moran ashley.moran at patchspace.co.uk
Sun Dec 20 13:51:23 EST 2009

On Dec 20, 2009, at 6:07 am, Elliot Winkler wrote:

> raise_error already catches any type of exception, error or not:
>   class BlahException < Exception; end
>   class BlahError < StandardError; end
>  lambda { raise BlahException }.should raise_error(BlahException)
>  lambda { raise BlahError }.should raise_error(BlahError)
>  lambda { raise "blah" }.should raise_error(RuntimeError, "blah")

Although it would be unusual to catch non-Error Exceptions in most cases?  Most indicate unrecoverable failure; only the SignalException looks like something you might want to catch - I don't know, though.  I assume you'd normally register a handler for that.



More information about the rspec-users mailing list