rspec/rspec-mocks — pull request #177 by basvodde (2012-08-23 07:36:13+00:00)
Title: Alternative implementation (preferred) than Pull Request 176

This is the alternative implementation that I mentioned in Pull Request 176.

I would personally prefer this implementation over the other one. It is simpler and is effectively no additional LOC over the original implementation and only one parameter and one additional (inline) if.

But the main reason for preferring this implementation is that it fails earlier. When you pass an Exception class to the and_raise that cannot be created, then it will raise an ArgumentError in and_raise and not in raise_exception (when it would be used). This makes debugging this a lot easier.

This does change the behavior of RSpec from late failure to early failure (which I consider a positive change)