Add tests for controller

- and yay, I thought of a way to kinda spy on functions!
  not terribly generic, but really feasible when you want to spy
  on functions defined by you. Won't work on functions called by
  name, though.