[Jifty-commit] r587 - in jifty/trunk: t/TestApp/lib/TestApp t/TestApp/t t/TestApp/web/templates/dispatch

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Feb 15 21:04:33 EST 2006


Author: trs
Date: Wed Feb 15 21:04:32 2006
New Revision: 587

Added:
   jifty/trunk/t/TestApp/lib/TestApp/Dispatcher.pm
   jifty/trunk/t/TestApp/t/02-dispatch.t
   jifty/trunk/t/TestApp/web/templates/dispatch/
   jifty/trunk/t/TestApp/web/templates/dispatch/basic
   jifty/trunk/t/TestApp/web/templates/dispatch/basic-show
Modified:
   jifty/trunk/   (props changed)

Log:
 r8590 at wintermute:  tom | 2006-02-15 21:01:54 -0500
 Tests for dispatcher bug regarding the 'dispatch' function


Added: jifty/trunk/t/TestApp/lib/TestApp/Dispatcher.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/lib/TestApp/Dispatcher.pm	Wed Feb 15 21:04:32 2006
@@ -0,0 +1,24 @@
+package TestApp::Dispatcher;
+use Jifty::Dispatcher -base;
+
+on '/dispatch/' => run {
+    dispatch "/dispatch/basic";
+};
+
+on '/dispatch/show/' => run {
+    dispatch "/dispatch/basic-show";
+};
+
+
+my $count = 0;
+
+on '/dispatch/basic' => run {
+    set count => $count++;
+};
+
+on '/dispatch/basic-show' => run {
+    set count => $count++;
+    show '/dispatch/basic-show';
+};
+
+1;

Added: jifty/trunk/t/TestApp/t/02-dispatch.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/t/02-dispatch.t	Wed Feb 15 21:04:32 2006
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+BEGIN {chdir "t/TestApp"}
+use lib '../../lib';
+use Jifty::Test tests => 16;
+use Jifty::Test::WWW::Mechanize;
+
+my $server  = Jifty::Test->make_server;
+
+isa_ok($server, 'Jifty::Server');
+
+my $URL     = $server->started_ok;
+my $mech    = Jifty::Test::WWW::Mechanize->new();
+
+$mech->get_ok("$URL/dispatch/basic");
+$mech->content_contains("Basic test.");
+$mech->content_contains("Count 0");
+
+$mech->get_ok("$URL/dispatch/basic-show");
+$mech->content_contains("Basic test with forced show.");
+$mech->content_contains("Count 1");
+
+$mech->get_ok("$URL/dispatch/show/");
+$mech->content_contains("Basic test with forced show.");
+$mech->content_contains("Count 2");
+$mech->content_lacks("Count 3");
+
+$mech->get_ok("$URL/dispatch/");
+$mech->content_contains("Basic test.");
+$mech->content_contains("Count 3");
+$mech->content_lacks("Count 4");
+
+
+

Added: jifty/trunk/t/TestApp/web/templates/dispatch/basic
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/web/templates/dispatch/basic	Wed Feb 15 21:04:32 2006
@@ -0,0 +1,3 @@
+<&| /_elements/wrapper, title => "Test of dispatch" &>
+  Basic test.  (Count <% $ARGS{count} %>)
+</&>

Added: jifty/trunk/t/TestApp/web/templates/dispatch/basic-show
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/web/templates/dispatch/basic-show	Wed Feb 15 21:04:32 2006
@@ -0,0 +1,3 @@
+<&| /_elements/wrapper, title => "Test of dispatch" &>
+  Basic test with forced show.  (Count <% $ARGS{count} %>)
+</&>


More information about the Jifty-commit mailing list