test two endpoints with the same endpoint name (empty string)
Dave Rolsky [Sun, 23 Jan 2011 20:55:21 +0000 (14:55 -0600)]
t/lib/MyApp1/Controller/C1.pm
t/routes.t

index 23e315e..d2991f5 100644 (file)
@@ -59,7 +59,18 @@ chain_point '_set_user'
 get ''
     => chained '_set_user'
     => args 0
-    => sub { $REQ{empty} = $REQ{user} };
+    => sub { $REQ{user_end} = $REQ{user} };
+
+chain_point '_set_thing'
+    => chained '/'
+    => path_part 'thing'
+    => capture_args 1
+    => sub { $REQ{thing} = $_[2] };
+
+get ''
+    => chained '_set_thing'
+    => args 0
+    => sub { $REQ{thing_end} = $REQ{user} };
 
 sub normal : Chained('/') : Args(0) {
     $REQ{normal}++;
index 3ffb66c..c90af4b 100644 (file)
@@ -109,12 +109,26 @@ use HTTP::Request::Common qw( GET PUT POST DELETE );
     );
 
     is(
-        $MyApp1::Controller::C1::REQ{empty}, 99,
+        $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(