Mock arr.map(&:to_s) with rspec
<p>Consider the following code with a <code>#map(&amp;:to_s)</code> call:</p>

<pre><code>arr = [1,2,3]
arr.map(&amp;:to_s)
</code></pre>

<p>You could mock it out like this</p>

<pre><code>expect(arr).to receive(:map) { |arg|
  expect(arg).to receive(:to_s)
}.and_return(["some","values"])
</code></pre>

<p><strong>but this isn't very handy, and I use the shortcut alot in my code.</strong></p>

<blockquote>
  <p>Is there a handy shortcut (or is it possible to create one?) for mocking out <code>map(&amp;:to_s)</code> calls in RSpec?</p>
</blockquote>