Merge pull request #225 from gunnarahlberg/master
spec that to spy on an undefined method throws exception
This commit is contained in:
@@ -165,6 +165,21 @@ describe('Spies', function () {
|
|||||||
expect(exception).toBeDefined();
|
expect(exception).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('to spy on an undefined method throws exception', function() {
|
||||||
|
var TestClass = {
|
||||||
|
someFunction : function() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function efunc() {
|
||||||
|
this.spyOn(TestClass, 'someOtherFunction');
|
||||||
|
};
|
||||||
|
expect(function() {
|
||||||
|
efunc();
|
||||||
|
}).toThrow('someOtherFunction() method does not exist');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
it('should be able to reset a spy', function() {
|
it('should be able to reset a spy', function() {
|
||||||
var TestClass = { someFunction: function() {} };
|
var TestClass = { someFunction: function() {} };
|
||||||
this.spyOn(TestClass, 'someFunction');
|
this.spyOn(TestClass, 'someFunction');
|
||||||
|
|||||||
Reference in New Issue
Block a user