title: Sinon.js - stub React component's function before component is instantiated?
body: <p>Let's say I have a component that looks like this:</p>
  
  <pre><code>var React = require('react/addons');
  
  var ExampleComponent = React.createClass({
      test : function () {
          return true;
      },
      render : function () {
          var test = this.test();
          return (
              &lt;div className="test-component"&gt;
                  Test component - {test}
              &lt;/div&gt;
          );
      }
  });
  
  module.exports = ExampleComponent;
  </code></pre>
  
  <p>In my test, I could render this component using <code>TestUtils</code>, then stub out the method like so:</p>
  
  <pre><code>var renderedComponent = TestUtils.renderIntoDocument(&lt;ExampleComponent/&gt;);
  sinon.stub(renderedComponent, 'test').returns(false);
  expect(renderedComponent.test).toBe(false); //passes
  </code></pre>
  
  <p>But is there a way I could tell Sinon to automatically stub out a component's function every time an instance of that component is created?  Ex:</p>
  
  <pre><code>sinon.stubAll(ExampleComponent, 'test').returns(false); //something like this
  var renderedComponent = TestUtils.renderIntoDocument(&lt;ExampleComponent/&gt;);
  expect(renderedComponent.test).toBe(false); //I'd like this to pass
  </code></pre>
  
  <p>If this isn't possible, is there a potential solution that comes close to providing the functionality I'm looking for?</p>