Add test for ReposController#new and small refactor