Create a spy that keeps track of how many times a function is called.