rspec/rspec-mocks — pull request #156 by amarshall (2012-06-27 02:48:43+00:00)
Title: Raise RuntimeError instead of Exception by default in and_raise to match Ruby default

The default exception raised by `raise` is RuntimeError, yet RSpec's `and_raise` raises Exception by default. This means that simple examples like this fail:

```
def exceptions_test(obj)
obj.some_method
rescue
end

describe do
it do
obj = double("foo")
obj.stub(:some_method).and_raise
-> { exceptions_test(obj) }.should_not raise_error
end
end
```

with

```
Failure/Error: -> { exceptions_test(obj) }.should_not raise_error
expected no Exception, got #
```

This isn't what I would expect given that no exception classes are explicitly specified anywhere, so they behavior (I would think) would be consistent and the test should pass.

This also stems from the fact that Exception is the root of Ruby's exception hierarchy, and shouldn't be rescued from without good reason. Having it be the default for `and_raise` may encourage rescuing from Exception unnecessarily to make the test pass.