[Jifty-commit] r4157 - in jifty/trunk: lib/Jifty/Test/WWW t/TestApp/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Sep 26 14:58:33 EDT 2007


Author: sartak
Date: Wed Sep 26 14:58:31 2007
New Revision: 4157

Added:
   jifty/trunk/lib/Jifty/Test/WWW/Declare.pm
   jifty/trunk/t/TestApp/t/18-test-www-declare.t
Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/Makefile.PL

Log:
 r43101 at onn:  sartak | 2007-09-26 14:47:29 -0400
 Initial implementation of Jifty::Test::WWW::Declare, with basic tests in TestApp


Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL	(original)
+++ jifty/trunk/Makefile.PL	Wed Sep 26 14:58:31 2007
@@ -70,6 +70,7 @@
 requires('Test::LongString');
 requires('Test::More' => 0.62 ),
 requires('Test::Pod::Coverage'),
+requires('Test::WWW::Declare'),
 requires('Test::WWW::Mechanize' => 1.04 ),
 requires('Test::WWW::Selenium'),
 requires('WWW::Mechanize' => 1.30 ),

Added: jifty/trunk/lib/Jifty/Test/WWW/Declare.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/lib/Jifty/Test/WWW/Declare.pm	Wed Sep 26 14:58:31 2007
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+package Jifty::Test::WWW::Declare;
+use strict;
+use warnings;
+use base qw(Exporter);
+BEGIN { require Jifty::Test; require Test::WWW::Declare }
+
+our @EXPORT = qw($server $URL);
+
+our $server;
+our $URL;
+
+sub import
+{
+    my $class = shift;
+
+    # examine the plan
+    Test::More->import(@_);
+
+    # set up database and other things
+    Jifty::Test->setup($class);
+
+    # export the DSL-ey functions
+    Test::WWW::Declare->export_to_level(2);
+
+    # export $server, $URL, and whatever else J:T:W:D adds
+    __PACKAGE__->export_to_level(1);
+
+    # create a server (which will be automatically exported)
+    $server = Jifty::Test->make_server;
+    $URL = $server->started_ok;
+}
+
+1;
+

Added: jifty/trunk/t/TestApp/t/18-test-www-declare.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/t/18-test-www-declare.t	Wed Sep 26 14:58:31 2007
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test::WWW::Declare tests => 2;
+
+# this is a duplication of t/TestApp/t/17-template-region-internal-redirect.t
+# if the user sees failures here, then he either saw failures in t/17 OR
+# J:T:W:D is broken
+
+session user => run {
+    flow "region with internal redirects" => check {
+        get "$URL/region-with-internal-redirect";
+        content should match qr/redirected ok/;
+        content should match qr/other region/;
+        content should match qr/still going/;
+        content shouldnt match qr/sorry/;
+    };
+};
+


More information about the Jifty-commit mailing list