Skip to content

Commit

Permalink
Fixes #117
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Jul 14, 2016
1 parent b471b48 commit abbf051
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/store/calls.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ _ = require('lodash')
store = require('./index')
argsMatch = require('./../args-match')

lastCall = null #<-- remember this to pop our DSL of when(<call>)/verify(<call>)
store.onReset -> lastCall = null
callHistory = [] #<-- remember this to pop our DSL of when(<call>)/verify(<call>)
store.onReset -> callHistory = []

module.exports =

log: (testDouble, args, context) ->
store.for(testDouble).calls.push({args, context})
lastCall = {testDouble, args, context}
callHistory.push({testDouble, args, context})

pop: ->
_.tap (call = lastCall), (call) ->
lastCall = null #<-- no double-dipping since it's global & destructive
_.tap (callHistory.pop()), (call) ->
store.for(call.testDouble).calls.pop() if call?

wasInvoked: (testDouble, args, config) ->
Expand Down

0 comments on commit abbf051

Please sign in to comment.