This change will also help to avoid a common pitfall when people pass the last argument (as a string) to assert_raises thinking that it will be matched against the error too. Personally, I was in this trap several times.
with match: basically calling assert_match match, error.message.
The reason I think match is important is that with error_highlight and such, it’s not common to have unpredictable stuff appended to the message, so you don’t want to do an exact comparison most of the time.
Yes, looks more flexible. match looks a little vague to me, because we are already trying to kinda 'match’ing exceptions, it is not probably exactly clear what this match does different. But I do not have a better name.
So, do you suggest to try to push this forward to the minitest library itself?
match looks a little vague to me, because we are already trying to kinda 'match’ing exceptions
The alternative is message: /foo/, but I fear it may be confusing with the assertion message.
So, do you suggest to try to push this forward to the minitest library itself?
You can try if you wish, but the maintainer is rarely open to new feature. Best is probably to submit the feature in both Active Support and Minitest. We can add this to Active Support and remove it later if it’s accepted upstream.