title: Jasmine - Spying on a method call within a constructor
body: <p>I want to test whether the following method is called with in my Javascript object constructor. From what I have seen in the Jasmine documentation, I can spy on a constructor method and I can spy on methods after an object has been instantiated, but I can't seem to be able to spy on a method before the object is constructed.</p>
  
  <p>The object:</p>
  
  <pre><code>Klass = function() {
      this.called_method();
  };
  
  Klass.prototype.called_method = function() {
    //method to be called in the constructor.
  }
  </code></pre>
  
  <p>I want to do something like this in the spec:</p>
  
  <pre><code>it('should spy on a method call within the constructor', function() {
      spyOn(window, 'Klass');
      var obj = new Klass();
      expect(window.Klass.called_method).toHaveBeenCalled();
  });
  </code></pre>