Application controller specs

with some small refactoring