Alternative implementation (preferred) than Pull Request 176
Created by: basvodde
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)