Write a test for making Router.routes accept a function

[#2255]
Make Router.routes accept a function

[#2255]
Fix test: making vars local
Merge pull request #2375 from davidinjc/routes_function

Allow extending Router.routes by accepting a function