[Catalyst-commits] r9538 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sat Mar 21 14:21:44 GMT 2009


Author: t0m
Date: 2009-03-21 14:21:44 +0000 (Sat, 21 Mar 2009)
New Revision: 9538

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm
   Catalyst-Runtime/5.80/trunk/t/unit_load_catalyst_test.t
Log:
Merge r9534 renaming kanes crequest to ctx_request up from 5.70 trunk. 5.80 is now up to date with all changes in 5.70

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2009-03-21 14:16:33 UTC (rev 9537)
+++ Catalyst-Runtime/5.80/trunk/Changes	2009-03-21 14:21:44 UTC (rev 9538)
@@ -1,7 +1,7 @@
 # This file documents the revision history for Perl extension Catalyst.
 
-        - Add Catalyst::Test::crequest to return both HTTP::Response object
-          & $c for local requests (kane)
+        - Added Catalyst::Test::ctx_request to be able to inspect
+          the context object after a request is made (Jos Boumans)
         - debug() POD rewrite (jhannah)
         - Change the warning when you have conflicting components to
           present a list (t0m)

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm	2009-03-21 14:16:33 UTC (rev 9537)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm	2009-03-21 14:21:44 UTC (rev 9538)
@@ -30,10 +30,10 @@
 
     my $get = sub { $request->(@_)->content };
 
-    my $crequest = sub {
+    my $ctx_request = sub {
         my $me      = ref $self || $self;
 
-        ### throw an exception if crequest is being used against a remote
+        ### throw an exception if ctx_request is being used against a remote
         ### server
         Catalyst::Exception->throw("$me only works with local requests, not remote")
             if $ENV{CATALYST_SERVER};
@@ -60,9 +60,9 @@
     };
 
     return {
-        request  => $request,
-        get      => $get,
-        crequest => $crequest,
+        request      => $request,
+        get          => $get,
+        ctx_request  => $ctx_request,
         content_like => sub {
             my $action = shift;
             return Test::More->builder->like($get->($action), at _);
@@ -118,7 +118,7 @@
     use Catalyst::Test 'TestApp';
     my $content  = get('index.html');           # Content as string
     my $response = request('index.html');       # HTTP::Response object
-    my($res, $c) = crequest('index.html');      # HTTP::Response & context object
+    my($res, $c) = ctx_request('index.html');      # HTTP::Response & context object
 
     use HTTP::Request::Common;
     my $response = request POST '/foo', [
@@ -197,7 +197,7 @@
 
 =head1 FUNCTIONS
 
-=head2 ($res, $c) = crequest( ... );
+=head2 ($res, $c) = ctx_request( ... );
 
 Works exactly like C<Catalyst::Test::request>, except it also returns the
 catalyst context object, C<$c>. Note that this only works for local requests.

Modified: Catalyst-Runtime/5.80/trunk/t/unit_load_catalyst_test.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_load_catalyst_test.t	2009-03-21 14:16:33 UTC (rev 9537)
+++ Catalyst-Runtime/5.80/trunk/t/unit_load_catalyst_test.t	2009-03-21 14:21:44 UTC (rev 9538)
@@ -19,7 +19,7 @@
 my $Content = "root index";
 
 my %Meth    = (
-    $Pkg    => [qw|get request crequest|],          # exported
+    $Pkg    => [qw|get request ctx_request|],          # exported
     $Class  => [qw|local_request remote_request|],  # not exported
 );
 
@@ -66,7 +66,7 @@
     ### test exported methods again
     for my $meth ( @{ $Meth{$Pkg} } ) { SKIP: {
 
-        ### do a call, we should get a result and perhaps a $c if it's 'crequest';
+        ### do a call, we should get a result and perhaps a $c if it's 'ctx_request';
         my ($res, $c) = eval { $Pkg->can($meth)->( $Url ) };
         
         ok( 1,                  "   Called $Pkg->$meth( $Url )" );
@@ -78,8 +78,8 @@
         is( $res_as_string, $Content,
                                 "           Content as expected: $res_as_string" );    
         
-        ### some tests for 'crequest'
-        skip "Context tests skipped for '$meth'", 6 unless $meth eq 'crequest';
+        ### some tests for 'ctx_request'
+        skip "Context tests skipped for '$meth'", 6 unless $meth eq 'ctx_request';
         
         ok( $c,                 "           Context object returned" );
         isa_ok( $c, $App,       "               Object" );




More information about the Catalyst-commits mailing list