Last active
August 29, 2015 14:01
-
-
Save lijie2000/6fcaacaa025748bee943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['underscore' | |
], function (_) { | |
'use strict'; | |
describe('a spy', function () { | |
console.log('settings check in <<<'); | |
var foo, bar = null; | |
beforeEach(function () { | |
foo = { | |
setBar: function (value) { | |
bar = value; | |
} | |
}; | |
spyOn(foo, 'setBar'); | |
foo.setBar(123); | |
foo.setBar(456, 'another param'); | |
}); | |
it('tracks that the spy was called', function () { | |
expect(foo.setBar).toHaveBeenCalled(); | |
}); | |
it('tracks all the arguments of its calls', function () { | |
expect(foo.setBar).toHaveBeenCalledWith(123); | |
expect(foo.setBar).toHaveBeenCalledWith(456, 'another param'); | |
}); | |
it('tests underscore', function () { | |
expect(_.size([1, 2, 3])).toBe(3); | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when run
grunt test
, got errortest/spec/settings/settingSpec.js
line 17 col 7 'spyOn' is not defined.
Same kind of error when use
jasmine.createSpy()
,jasmine is not defined.