Why use spyOn instead of jasmine.createSpy?

Viewed 17028

What is the difference between

jasmine.createSpy('someMethod')

And

spyOn(someObject, 'someMethod')

And why should one choose to use spyOn?

My guess is that the first alternative will match the method someMethod no matter in what object it's contained but spyOn will only match if it's contained in someObject. Thus making createSpy just a more generic matcher?

2 Answers
Related