How to use RSpec's should_raise with any kind of exception?

exception, rspec, ruby, ruby-on-rails

Solution

expect { some_method }.to raise_error

RSpec 1 Syntax:

lambda { some_method }.should raise_error

See the documentation (for RSpec 1 syntax) and RSpec 2 documentation for more.

Problem

I'd like to do something like this: ``` some_method.should_raise <any kind of exception, I don't care> ``` How should I do this? ``` some_method.should_raise exception ``` ... doesn't work.

Original source