Jasmine Spy Undefined

coffeescript, jasmine, jasmine-jquery, javascript

Solution

Take the `()` off the end of `Subscription.prototype.runSimulation()`:

  expect(Subscription.prototype.runSimulation).toHaveBeenCalled()

Problem

When I run my jasmine specs I get the following error: ``` Error: Expected a spy, but got undefined. ``` My coffeescript code: ``` describe "setupForm", -> beforeEach -> spyOn(Subscription.prototype, 'runSimulation') it "calls subscription.runSimulation when form is submitted with number", -> Subscription.prototype.runSimulation() expect(Subscription.prototype.runSimulation()).toHaveBeenCalled() ``` I have simplfied my erroring code to the above for debugging, but I can't figure out why it is saying the spy is never called when I'm explicitly calling it my test. I am testing the method in other places, so I think the error has to be with how I am using the Jasmine Spy. Thanks.

Original source