Try::Tiny used so we can catch a detach from the like of Credential::HTTP as per...
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthRealmTestAppProgressive / Controller / Root.pm
index 8e48623..4e9037f 100644 (file)
@@ -3,7 +3,7 @@ use warnings;
 use strict;
 use base qw/Catalyst::Controller/;
 
-__PACKAGE__->config(namespace => '');
+__PACKAGE__->config( namespace => '' );
 
 use Test::More;
 use Test::Exception;
@@ -12,18 +12,22 @@ sub progressive : Local {
     my ( $self, $c ) = @_;
 
     foreach my $realm ( keys %AuthRealmTestAppProgressive::members ) {
-        while ( my ( $user, $info ) = each %{$AuthRealmTestAppProgressive::members{$realm}} ) {
+        while ( my ( $user, $info ) =
+            each %{ $AuthRealmTestAppProgressive::members{$realm} } )
+        {
+            my $res;
             my $ok = eval {
-                $c->authenticate(
+                $res = $c->authenticate(
                     { username => $user, password => $info->{password} },
-                ); 
+                );
+                1;
             };
-            ok( !$@, "authentication passed." );
-            ok( $ok, "user authenticated" );
+            ok( !$@,                       "authentication passed." );
+            ok( $ok,                       "user authenticated" );
             ok( $c->user_in_realm($realm), "user in proper realm" );
         }
     }
-    $c->res->body( "ok" );
+    $c->res->body("ok");
 }
 
 1;