sethvargo/chefspec — pull request #341 by bytheway (2014-02-06 04:02:05+00:00)
Title: Fix the monkey-patch to the raise_error matcher

I don't really like the non-rubyish `#get_expected_error` method name (suggestions?), but this adds the direct access to the `@expected_error` object that chefspec is looking for, without breaking the `raise_error` matcher's functionality.

I tried first to just make the original `RaiseError#expected_error` method available publicly (it is a private method in `RaiseError`), but RSpec only returns a mutated form of `@expected_error` from that method, which breaks `ChefSpec's ExpectException` when it tries to do its comparisons.

So, in the end, the most harmless way to get at what `ExpectException` needs to do its job is to make another method to get at the `@expected_error object`.

Doing things this way fixes #339. I did not add a regression for that specific issue because anything I thought of doing felt like testing RSpec. ChefSpec just had to stop stomping on RSpec's method. If a regression is still wanted, I'm open to suggestions.