minor code example fix in documentation
[catagits/Catalyst-Plugin-Authentication.git] / t / 06_user.t
index f408163..244335e 100644 (file)
@@ -1,12 +1,15 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
-use Test::More tests => 7;
+use Test::More;
 use Test::Exception;
 
-my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::User") }
+my $m; BEGIN { use_ok($m = "Catalyst::Authentication::User") }
+
+{
+    package SomeBaseUser;
+    sub other_method { 'FNAR' };
+}
 
 {
        package SomeUser;
@@ -23,6 +26,9 @@ my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::User") }
                        top_level => 1,
                }
        }
+    sub get_object {
+        bless {}, 'SomeBaseUser';
+    }
 }
 
 my $o = SomeUser->new;
@@ -35,10 +41,16 @@ ok( !$o->supports(qw/feature unsupported_subfeature/), "traversal terminating in
 
 lives_ok {
        $o->supports("bad_key");
-} "cant check for non existent feature";
+} "can check for non existent feature";
+
+#dies_ok {
+#      $o->supports(qw/bad_key subfeature/)
+#} "but can't traverse into one";
+
+lives_ok {
+    is $o->other_method, 'FNAR', 'Delegation onto user object works';
+} 'Delegation lives';
 
-dies_ok {
-       $o->supports(qw/bad_key subfeature/)
-} "but can't traverse into one";
+done_testing;