Ruby minitest - better assert formatting possible?
<p>I have a test for a large manually entered data structure to catch bad entries.  The structure is an array of hashes and one check is to ensure that there are no duplicated values for a specific key (ID field).  </p>

<p>Is it possible to capture the failing <code>assert_empty()</code> data (the stuff in the returned <code>Expected ... to be empty</code> string) and format it into the <code>assert_empty()</code> message string?</p>

<p>The code below works but I'm performing the large operation twice; I want to perform the operation once.  Can this be done in a one-liner since the return value of the function is dumped into the minitest assertion error message?  I'm hoping for a variable of some kind?</p>

<pre><code>assert_empty large_filtering_operation(bar), "Duplicated ID #{large_filtering_operation(bar)["id"]} detected in #{bar}"
</code></pre>