 <p>You use a "yield matcher" as described in <a href="https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/yield-matchers#yield-with-args-matcher" rel="nofollow">https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/yield-matchers#yield-with-args-matcher</a></p> <p>For example, you could do:</p> <pre><code>expect {|b| controller.respond_with(&amp;b)}.to yield_with_args(MyResponse) </code></pre> <p>if you just wanted to check that the block was called exactly once with a <code>MyResponse</code> argument.</p>