spy on function just once