X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Froutes.t;h=c90af4b082da2a5730daf2d1eb961d0b360daeb8;hb=058ab36b2a72bf2c6d353fb3795d2783067c9624;hp=fc2557b0d43de7dd8fa46e2920a633b7bf035faf;hpb=ffc588239001d163a5c27429a48ac4637bdf37dd;p=catagits%2FCatalystX-Routes.git diff --git a/t/routes.t b/t/routes.t index fc2557b..c90af4b 100644 --- a/t/routes.t +++ b/t/routes.t @@ -82,18 +82,65 @@ use HTTP::Request::Common qw( GET PUT POST DELETE ); } { + get('/chain1/42/chain2/84/baz/foo'); + + is( + $MyApp1::Controller::C1::REQ{chain1}, 42, + 'chain1 chain point captured the first arg' + ); + + is( + $MyApp1::Controller::C1::REQ{chain2}, 84, + 'chain2 chain point captured the second arg' + ); + + is( + $MyApp1::Controller::C1::REQ{baz}, 'foo', + 'baz route captured the third arg' + ); +} + +{ + get('/user/99'); + + is( + $MyApp1::Controller::C1::REQ{user}, 99, + 'get /user/99 calls _set_user chain point' + ); + + is( + $MyApp1::Controller::C1::REQ{user_end}, 99, + 'get /user/99 calls get chained from _set_user' + ); +} + +{ + get('/thing/99'); + + is( + $MyApp1::Controller::C1::REQ{thing}, 99, + 'get /thing/99 calls _set_thing chain point' + ); + + is( + $MyApp1::Controller::C1::REQ{thing_end}, 99, + 'get /thing/99 calls get chained from _set_thing' + ); +} + +{ get('/normal'); is( $MyApp1::Controller::C1::REQ{normal}, 1, - 'GET request for /norma went to the right sub' + 'GET request for /normal went to the right sub' ); request( POST '/normal' ); is( $MyApp1::Controller::C1::REQ{normal}, 2, - 'POST request for /norma went to the right sub' + 'POST request for /normal went to the right sub' ); }