title: Does Jasmine's toThrow matcher require the argument to be wrapped in an anonymous function?
body: <p>The documentation at <em><a href="https://github.com/pivotal/jasmine/wiki/Matchers" rel="nofollow noreferrer">https://github.com/pivotal/jasmine/wiki/Matchers</a></em> includes the following:</p>
  <pre><code>expect(function(){fn();}).toThrow(e);
  </code></pre>
  <p>As discussed in <a href="https://stackoverflow.com/questions/4144686/how-to-write-a-test-which-expects-an-error-to-be-thrown">this question</a>, the following does <strong>not</strong> work, because we want to pass a function object to <code>expect</code> rather than the result of calling <code>fn()</code>:</p>
  <pre><code>expect(fn()).toThrow(e);
  </code></pre>
  <p>Does the following work?</p>
  <pre><code>expect(fn).toThrow(e);
  </code></pre>
  <p>If I've defined an object <code>thing</code> with a method <code>doIt</code>, does the following work?</p>
  <pre><code>expect(thing.doIt).toThrow(e);
  </code></pre>
  <p>(If so, is there a way to pass arguments to the <code>doIt</code> method?)</p>
  <p>Empirically the answer seems to be yes, but I don't trust my understanding of JavaScript scoping quite enough to be sure.</p>