allow dispatching to a method name as a string instead of a sub
[catagits/Web-Simple.git] / t / dispatch_misc.t
index 517a3e0..05bdd67 100644 (file)
@@ -16,11 +16,13 @@ my @dispatch;
 
     package MiscTest;
     sub dispatch_request { @dispatch }
+    sub string_method { [ 999, [], [""] ]; }
 }
 
 my $app = MiscTest->new;
 sub run_request { $app->run_test_request( @_ ); }
 
+string_method_name();
 app_is_non_plack();
 app_is_object();
 app_is_just_sub();
@@ -34,6 +36,14 @@ matcher_nonsub_pair();
 
 done_testing();
 
+sub string_method_name {
+    @dispatch = ( '/' => "string_method" );
+
+    my $get = run_request( GET => 'http://localhost/' );
+
+    cmp_ok $get->code, '==', 999, "a dispatcher that's a string matching a method on the dispatch object gets executed";
+}
+
 sub app_is_non_plack {
 
     my $r = HTTP::Response->new( 999 );