title: How do you spy on AngularJS's $timeout with Jasmine?
body: <p>I am trying to spy on $timeout so that I can verify that it has not been called. Specifically, my production code (see below) calls $timeout as a function, not an object:</p>
  
  <pre><code>$timeout(function() { ... })
  </code></pre>
  
  <p>and not</p>
  
  <pre><code>$timeout.cancel() // for instance
  </code></pre>
  
  <p>Jasmine, however, requires an object to be spied upon, like this:</p>
  
  <pre><code>spyOn(someObject, '$timeout')
  </code></pre>
  
  <p>I don't know what 'someObject' would be though.</p>
  
  <p>I am using Angular mocks, if that makes any difference.</p>
  
  <p>Edit: The relevant production code I'm trying to test looks like this:</p>
  
  <pre><code>EventHandler.prototype._updateDurationInOneSecondOn = function (call) {
      var _this = this;
      var _updateDurationPromise = this._$timeout(function () {
              call.duration = new Date().getTime() - call.startTime;
              _this._updateDurationInOneSecondOn(call);
          }, 1000);
      // ... more irrelevant code
  }
  </code></pre>
  
  <p>In the specific test scenario I am trying to assert that $timeout was never called.</p>
  
  <p>Edit 2: Specified clearly that I am using $timeout as a function, not an object.</p>