[rspec-users] no should raise_exception

David Chelimsky dchelimsky at gmail.com
Tue Dec 22 17:08:49 EST 2009

On Tue, Dec 22, 2009 at 9:33 AM, rogerdpack <rogerpack2005 at gmail.com> 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")
> Thanks for the response.  I think my request was more of a "why call
> them errors--in my head one doesn't raise errors--one raises
> exceptions and interprets them as errors, so allowing for the syntax
> raise_exception would be more mind friendly to me."

What I really want to say is "should raise(Blah)" but Ruby already defines
raise as a keyword :)

I'd be open to aliasing raise_error with raise_exception, renaming it to
raise_exception and aliasing raise_error for compatibility, but I think this
might just add confusion rather than clarifying intent. Thoughts?


> -r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091222/89d57379/attachment.html>

More information about the rspec-users mailing list