title: jasmine testing on external library
body: <p>I am attempting to do some basic testing using jasmine. I use an external library &amp; what I intend to do is spy/mock the method calls on the library object (d3) and make sure appropriate methods are called on d3.</p>
  
  <pre><code>        var d3Spy = jasmine.createSpyObj('d3', ['select']);
          spyOn(window, 'd3').andReturn(d3Spy);
          expect(d3Spy.select).toHaveBeenCalled();
  </code></pre>
  
  <p>When 'select' is being called on the object, I get this error.</p>
  
  <pre><code>TypeError: Object function () {
  spyObj.wasCalled = true;
  spyObj.callCount++;
  var args = jasmine.util.argsToArray(arguments);
  spyObj.mostRecentCall.object = this;
  spyObj.mostRecentCall.args = args;
  spyObj.argsForCall.push(args);
  spyObj.calls.push({object: this, args: args});
  return spyObj.plan.apply(this, arguments);
   } has no method 'select'
  </code></pre>
  
  <p>What am I doing wrong?</p>