title: Is there a way to stub method using sinon where method has two arguments
body: <p>Let me explain the problem statement:</p>
  
  <p>I am using Mocha, Chai and Sinon. I am trying to stub a method which looks something like below:</p>
  
  <pre class="lang-js prettyprint-override"><code>myNamespace.myMethod({
    beforeSend() { ... }
  }, callback)
  </code></pre>
  
  <p>I want to stub <code>myMethod</code> and call <code>beforeSend</code> as well as <code>callback</code>. I am not able to find a solution that works. I have tried the following but it doesn't work:</p>
  
  <pre class="lang-js prettyprint-override"><code>sinon.stub(myNamespace, 'myMethod').yieldsTo('beforeSend', {}).callsArg(1);
  </code></pre>
  
  <p>What am I doing wrong?</p>