refactor tests for controllers