I read Test :: Mojo , but did not find how to use the route name while testing the application:
$t->get_ok( 'list_users' )->status_is( 302 )->location_is( 'auth_login' );
Where list_usersand auth_login:
$r->get( '/login' )->to( 'auth#login' )->name( 'auth_login' );
$r->get( '/users' )->to( 'user#index' )->name( 'list_users' );
It seems to me that it will be very convenient if *_okit considers this line the same as redirect_to. VOTEUP if it is well suited to request a function.
How to get around this problem, I try to use url_forwithout success:
$t->url_for( 'list_users' );
How can I get a route route by its name from a test script?
source
share