title: Verifying function call and inspecting arguments using sinon spies
body: <p>I would like to verify that <code>bar()</code> is called inside <code>foo()</code> from my unit test.</p>
  
  <p>I figured that <a href="http://sinonjs.org/docs/#spies-api" rel="noreferrer">Sinon spies</a> might be suitable, but I don't know how to use them.</p>
  
  <p>Is there any way to check that the method is called? Perhaps even extracting the arguments used in the <code>bar()</code> call?</p>
  
  <pre><code>var spy = sinon.spy(foo);
  
  function foo(){
      bar(1,2,3);
  }
  
  function bar(){ }
  
  foo();
  
  // what to do with the spy?
  </code></pre>
  
  <p><a href="http://jsfiddle.net/8by9jg07/" rel="noreferrer">http://jsfiddle.net/8by9jg07/</a></p>