Skip to content

Instantly share code, notes, and snippets.

@balaclark
Created May 19, 2015 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balaclark/aa8e03ae6057aded072d to your computer and use it in GitHub Desktop.
Save balaclark/aa8e03ae6057aded072d to your computer and use it in GitHub Desktop.
function spy() {
var called = false
, args = null
function spyFn() {
called = true
args = Array.prototype.slice.call(arguments)
}
spyFn.calledWith = function calledWith() {
return args
}
spyFn.reset = function reset() {
called = false
args = null
}
return spyFn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment