[Bps-public-commit] r17949 - in Path-Dispatcher/trunk: t

sartak at bestpractical.com sartak at bestpractical.com
Wed Jan 28 01:26:06 EST 2009


Author: sartak
Date: Wed Jan 28 01:26:04 2009
New Revision: 17949

Added:
   Path-Dispatcher/trunk/t/106-metadata.t
Modified:
   Path-Dispatcher/trunk/   (props changed)

Log:
 r79161 at onn:  sartak | 2009-01-28 01:25:36 -0500
 Tests for metadata-matching sugar


Added: Path-Dispatcher/trunk/t/106-metadata.t
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/t/106-metadata.t	Wed Jan 28 01:26:04 2009
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+my @calls;
+
+do {
+    package MyApp::Dispatcher;
+    use Path::Dispatcher::Declarative -base;
+
+    on { method => 'GET' } => sub {
+        push @calls, "method: GET, path: $_";
+    };
+};
+
+my $path = Path::Dispatcher::Path->new(
+    path     => "/REST/Ticket/1.yml",
+    metadata => {
+        method => "GET",
+    },
+);
+
+MyApp::Dispatcher->run($path);
+is_deeply([splice @calls], ["method: GET, path: /REST/Ticket/1.yml"]);
+



More information about the Bps-public-commit mailing list