title: how to write a jasmine test for a setinterval inside a prototype
body: <p>I want to write a test for my setInterval and test that the alert window has fired with the value 'pulse'. How do I do this? I've tried so many variations on this but can not seem to figure this out. I've provided the code and my spec file. I'm using jasmine 2.0. Any help is appreciated.</p>
  
  <p>countTimer.js</p>
  
  <pre><code>function CountTimer(timelength){
    this.timelength = timelength;
    this.running    = false;
  }
  
  CountTimer.prototype.start = function(){
    this.running = true;
    setInterval(function () {alert('pulse')}, 2000);
  };
  CountTimer.prototype.stop = function(){
    this.running = false;
  };
  </code></pre>
  
  <p>countTimerSpec.js</p>
  
  <pre><code>describe("Timer",function() {
    var myTimer;
  
  
    beforeEach(function() {
      myTimer = new CountTimer(25);
    });
  
  ...
  
    it("start should run setInterval 'pulse' every 2 seconds via setInterval", function(){
      myTimer.start();
  
      //what goes here???
  
      expect(sut.callback).toHaveBeenCalled();
    });
  
  
  });
  </code></pre>