I have read Test::Mojo but do not find how to use route name while application testing:
$t->get_ok( 'list_users' )->status_is( 302 )->location_is( 'auth_login' );
Where list_users
and auth_login
are:
$r->get( '/login' )->to( 'auth#login' )->name( 'auth_login' );
$r->get( '/users' )->to( 'user#index' )->name( 'list_users' );
I seems to me it will be very handy if *_ok
will count given string same as redirect_to
does. VOTEUP if this looks good for feature request to you too.
As work around this problem I try to use url_for
without success:
$t->url_for( 'list_users' );
#Can't locate object method "url_for" via package "Test::Mojo"
How can I get route path by its name from test script?