Prior to rspec-mocks 2.9.0, a trivial test like this would pass:
it "should raise an ArgumentError" do
error = ArgumentError.new("error message")
}.should raise_error(ArgumentError, "error message")
As of 2.9.0, this now fails with the rather cryptic message:
expected ArgumentError with "error message", got #<NoMethodError: undefined method `instance_method' for #<ArgumentError: error message>>
This appears to be a side effect of changes to introduce a friendlier error message when and_raise is called with an Exception class that doesn't have a zero-arg constructor. This fix explicitly checks for that case instead of trying to rescue all ArgumentErrors.
and_raise should support intentionally raising an ArgumentError
Thanks for the fix!