Create some way to do stub a function a certain number of times #33
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
question
Further information is requested
When making a stub, it may be desirable to only stub the function for a single call.
You can do this now, like:
But if you don't localize
hookStub
first, as would be common for these sorts of tests:You would get an error on your
hook.Call
invocation, with the error messageattempt to index global 'hookStub', a nil value
.This of course makes sense, but it can be confusing. Instead, perhaps we could have something like:
More realistically, we should allow a hook to be stubbed for any number of calls. Maybe as an optional third parameter to
stub()
?The text was updated successfully, but these errors were encountered: